Bug #54317 [NEW]: Regexp crashes Apache/PHP
| From: | christian dot achatz at adventure-php-framework dot org | Date: | Sat, 19 Mar 2011 15:05:27 +0000 |
| Subject: | Bug #54317 [NEW]: Regexp crashes Apache/PHP | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-159628@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows
PHP version: 5.3.6
Package: Regexps related
Bug Type: Bug
Bug description:Regexp crashes Apache/PHP
Description:
------------
---
From manual page: http://www.php.net/function.preg-replace#Description
---
Calling the script below apache crashes on windows installations. After
removing almost any of the lines inside $notworking apache will NOT crash,
no matter which line was removed in most cases.
Here is the system list that causes a crash or not:
Windows 7 SP1 (64bit) | XAMPP | Apache/2.2.17 (Win32) | PHP 5.3.5 | <<<<<<<
CRASH!
Windows XP (32+64bit) | XAMPP | Apache 2.2.17 | PHP 5.3.5 | <<<<<<< CRASH!
WinXP 32Bit / Apache 2.2.17 / PHP 5.2.14 <<<<<<< CRASH!
Fedora 32Bit / Apache 2.2.15 / PHP 5.3.3 --> OK
Ubuntu 10.10 32Bit / Apache2 2.2.16 / PHP 5.3.3 -> OK
Test script:
---------------
<?php
echo 'Is the following crashing apache or whatever?<br />'.PHP_EOL;
// After removing almost any of the lines inside $notworking apache will
NOT crash, no matter which line was removed in most cases.
$notworking = '<?php
//<*IslandStorageBase:start*> DO NOT CHANGE THIS COMMENT!
/**
* Automatically generated BaseObject for IslandStorage. !!DO NOT CHANGE
THIS BASE-CLASS!!
* CHANGES WILL BE OVERWRITTEN WHEN UPDATING!!
* You can change class "IslandStorage" which will extend this base-class.
*/
class IslandStorageBase extends AbstractSimpleStorage {
}
<*IslandStorageBase:end*>
?>';
$content = preg_replace(
'%//<\*IslandStorageBase:start\*>(.)+<\*IslandStorageBase:end\*>%s',
'test',
$notworking
);
echo 'If you can see this everything seems to be working fine.';
?>
Expected result:
----------------
Is the following crashing apache or whatever?
If you can see this everything seems to be working fine.
Actual result:
--------------
Apache crashes with the following log entry:
Parent: child process exited with status xyz -- Restarting.
--
Edit bug report at http://bugs.php.net/bug.php?id=54317&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54317&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54317&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54317&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54317&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54317&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54317&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54317&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54317&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54317&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54317&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54317&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54317&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54317&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54317&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54317&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54317&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54317&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54317&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54317&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54317&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54317&r=mysqlcfg