php.net |  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-31 04:22 UTC
Votes:15
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: No Feedback Package: PCRE related
PHP Version: 5.6.10 OS: OS X 10.10.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
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:
mbstring:
 - Multibyte regex (oniguruma) version 4.4.4
 - Multibyte regex (oniguruma) backtrack check On

The bug come from Drupal 5.2 /includes/common.inc function drupal_build_css_cache

Reproduce code:
---------------
<?
$data=
"
/*
** Details: http://www.positioniseverything.net/easyclearing.html
*/
";
$data = preg_replace('<
   \s*([@{}:;,]|\)\s|\s\()\s* |
   /\*([^*\\\\]|\*(?!/))+\*/ |
   [\n\r]
   >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.

Patches

Pull Requests

History

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.

<?php

$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);
var_dump($data);

test.html is here https://gist.github.com/sormy/b77420c0f0a9a50cbef1

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] requinix@php.net
-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] nikic@php.net
-Status: Re-Opened +Status: Feedback
 [2019-03-18 16:25 UTC] nikic@php.net
Does anyone still see this issue with PHP 7?
 [2019-03-31 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 02 22:01:30 2024 UTC