php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51784 Segmentation fault! causes apache to crash.
Submitted: 2010-05-10 13:52 UTC Modified: 2010-05-10 14:19 UTC
From: notdefix at hotmail dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: notdefix at hotmail dot com
New email:
PHP Version: OS:

 

 [2010-05-10 13:52 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-10 14:19 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2010-05-10 14:19 UTC] pajoye@php.net
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.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 28 19:03:44 2022 UTC