Edit report at http://bugs.php.net/bug.php?id=51784&edit=1

 ID:          51784
 Updated by:  paj...@php.net
 Reported by: notdefix at hotmail dot com
 Summary:     Segmentation fault! causes apache to crash.
-Status:      Open
+Status:      Bogus
 Type:        Bug
 Package:     PCRE related
 PHP Version: Irrelevant

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------
[2010-05-10 13:52:12] notdefix at hotmail dot com

Description:
------------
Copied from: http://nl2.php.net/preg_replace

PHP version: Unknown



preg_replace (and str_replace too) will crash php if you use ' ' (space)
as replace value for a large number of matches.



following Apache Error-Log message:



[Mon May 10 09:23:58 2010] [notice] child pid 39251 exit signal Illegal
instruction (4)



where pid 39251 was the PHP-thread processing that request.



Test script:
---------------
Copied from: http://nl2.php.net/preg_replace

PHP version: Unknown





For example:



$string = preg_replace('/( )+/', ' ', $string);

$string = str_replace(' ', ' ', $string);



will crash if $string contains many seperate matches of ' '
producing 





$string = preg_replace('/( )+/', '', $string);

$string = str_replace(' ', '', $string);



or



$string = preg_replace('/( )+/', '_', $string);

$string = str_replace(' ', '_', $string);



do all work fine.







This seems to be a bug in the underlying PCRE implementation, and not in
PHP itself.



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51784&edit=1

Reply via email to