#43117 [NEW]: using preg_replace count parameter (in wiki) causes total server meltdown
| From: | commentgg at hotmail dot com | Date: | Sat, 27 Oct 2007 18:21:01 +0000 |
| Subject: | #43117 [NEW]: using preg_replace count parameter (in wiki) causes total server meltdown | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-119000@lists.php.net to get a copy of this message | ||
From: commentgg at hotmail dot com
Operating system: Windows XP SP2
PHP version: 5.2.4
PHP Bug Type: Reproducible crash
Bug description: using preg_replace count parameter (in wiki) causes total server meltdown
Description:
------------
The wiki in development went from delivering total meltdown on the server
to being very stable just by changing the code from:
$n=0;
preg_replace(/../,'..',$x,-1,$n);
if($n) ..
to
$new = preg_replace(/../,'..',$x);
if($new != $x) ..
I.e. do not use the count parameter!
Reproduce code:
---------------
I can't give you any specifics yet, but I spent 3 days narrowing down and
then having the above solve the problem for me.
Sorry can't help you out better.
Actual result:
--------------
Crashes brought the Apache webserver (not the absolute latest) down on my
pre 5.2.4 version. Upgrading to the latest PHP (5.2.4) delivered a better
experience as the server managed to recover.
In both cases no error message was given. It all just ends in the Windows
Application Crash - Send Report feedback loop dialog box. Twice.
Maybe this is a PECL issue, but it is severe enough to warrant attention.
--
Edit bug report at http://bugs.php.net/?id=43117&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43117&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43117&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43117&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43117&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43117&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43117&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43117&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43117&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43117&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43117&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43117&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43117&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43117&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43117&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43117&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43117&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43117&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43117&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43117&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43117&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43117&r=mysqlcfg