Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex kills PHP script

Status
Not open for further replies.

sen5241b

IS-IT--Management
Sep 27, 2007
199
US
I call preg_match_all repeatedly in a loop and the script works fine. If however I pass preg_match_all a really big text string to search in, the script just dies after the nth time I call preg_match_all. The larger the input string the fewer times I can call preg_match_all before the script just dies. No error is produced.

I have this line at the start of script:

Code:
error_reporting(E_ALL);

If you have no idea what causes this, then please tell me how I might go about debugging this.
 
and make sure that display_errors is set to on.

Code:
ini_set('display_errors', true);
 
I need to post a simpler version of my code that captures the problem. I won't torture you with all the code.


This suggestion did not display any errors:

Code:
ini_set('display_errors', true);

I also used:
Code:
echo '<br>DEBUG: MEMORY PEAK=' . memory_get_peak_usage();

and it gave me: 2672532
memory_limit as per phpinfo is 160mg

phpinfo also shows:

pcre

PCRE (Perl Compatible Regular Expressions) Support enabled
PCRE Library Version 7.8 2008-09-05

Directive Local Value Master Value
pcre.backtrack_limit 100000 100000
pcre.recursion_limit 100000 100000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top