|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43185 preg_replace cause exit signal Illegal instruction
Submitted: 2007-11-04 14:21 UTC Modified: 2019-03-18 16:25 UTC
Avg. Score:4.4 ± 0.8
Reproduced:14 of 14 (100.0%)
Same Version:2 (14.3%)
Same OS:2 (14.3%)
From: nicolas dot fruit+phpbug at gmail dot com Assigned:
Status: Feedback Package: PCRE related
PHP Version: 5.6.10 OS: OS X 10.10.4
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.
Block user comment
Status: Assign to:
Bug Type:
From: nicolas dot fruit+phpbug at gmail dot com
New email:
PHP Version: OS:


 [2007-11-04 14:21 UTC] nicolas dot fruit+phpbug at gmail dot com
preg_replace cause a "exit signal Illegal instruction (4)" in the apache log.

My config:
Mac OS Darwin Kernel Version 8.9.0
Apache/2.0.61 (same error with Apache 2.2)
PHP Version 5.2.4
phpinfo related to regex:
 - Multibyte regex (oniguruma) version 4.4.4
 - Multibyte regex (oniguruma) backtrack check On

The bug come from Drupal 5.2 /includes/ function drupal_build_css_cache

Reproduce code:
** Details:
$data = preg_replace('<
   \s*([@{}:;,]|\)\s|\s\()\s* |
   /\*([^*\\\\]|\*(?!/))+\*/ |
   >x', '\1', $data);
echo $data;

Expected result:
Remove the css "comment" on the string

Actual result:
exit signal Illegal instruction (4)" in the apache log.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-03-10 00:10 UTC] lms at esoterica dot pt
Does not work on Darwin Kernel Version 9.2.0 and Apache/2.2.6 either (tested under PHP 5.2.4 as well). Crashes with the same message as reported.

The release notes for PHP 5.2.5 do not mention any fix for this particular bug.
 [2008-04-11 15:36 UTC] nejc at skoberne dot net
I am having the same problem with PHP 5.2.5, Apache 2.2.6 and Drupal 4.7 on FreeBSD 7.0.
 [2008-04-17 05:24 UTC] sabapamu at mizuho-sc dot com
I am having the same issue on Apache/2.2.8 (Unix) PHP/5.2.5 on RedHat Linux 3
 [2009-07-01 21:14 UTC] btmash at gmail dot com
I am having the same problem with PHP 5.2.9, Apache 2.2.11 and Drupal 6.12 on FreeBSD 7.1.
 [2009-10-29 08:24 UTC] d dot arnolds at gmail dot com
Same problem here with PHP 5.2.3, Apache 2.0.59 and Drupal
6.14 on FreeBSD 6.3.
 [2009-11-24 20:36 UTC] me at skylord dot ru
Same problem... PHP 5.2.11, FreeBSD 7.2, Apache 2.2.11, Drupal 6.14
 [2009-12-28 20:04 UTC] ddeineka at gmail dot com
Same problem with customer's Drupal. Fresh up-to-date ports, FreeBSD 8.0-RELEASE, PHP 5.2.11, Apache 2.2.14.
 [2015-07-08 02:25 UTC] art dot sormy at gmail dot com
The same situation:
* os x 10.10.4
* homebrew
* php 5.6.10
* apache 2.4.12

It works from command line, but doesn't work from apache.


$data = file_get_contents("test.html");
$regexp = '!(?:\s*<tr class="row\d+">(?:\s*'
        . '<td class="column\d+(\s+style\d+ [a-z])?">&nbsp;<\/td>)*\s*<\/tr>)+!s';
$data = preg_replace($regexp, "", $data);

test.html is here

this code will cause:
[Tue Jul 07 21:19:00.409400 2015] [core:notice] [pid 82348:tid 140735326831360] AH00052: child pid 83095 exit signal Illegal instruction (4)
 [2015-07-08 02:46 UTC]
-Status: No Feedback +Status: Re-Opened -Operating System: Mac +Operating System: OS X 10.10.4 -PHP Version: 5.2.4 +PHP Version: 5.6.10
 [2015-07-08 14:25 UTC] art dot sormy at gmail dot com
Minor update: switching Apache MPM from WORKER to PREFORK is fixing problem
 [2019-03-18 16:25 UTC]
-Status: Re-Opened +Status: Feedback
 [2019-03-18 16:25 UTC]
Does anyone still see this issue with PHP 7?
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Mar 26 10:01:25 2019 UTC