Bug #49697 [NoF->Bgs]: preg_replace crashes my system.

From: Date: Mon, 21 Jun 2010 22:26:36 +0000
Subject: Bug #49697 [NoF->Bgs]: preg_replace crashes my system.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151740@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=49697&edit=1

 ID:               49697
 Updated by:       felipe@php.net
 Reported by:      donquixote dot phplist at googlemail dot com
 Summary:          preg_replace crashes my system.
-Status:           No Feedback
+Status:           Bogus
 Type:             Bug
 Package:          PCRE related
 Operating System: Windows XP
 PHP Version:      5.2.11

 New Comment:

.


Previous Comments:
------------------------------------------------------------------------
[2010-04-25 20:53:13] felipe@php.net

Not a PHP bug.

------------------------------------------------------------------------
[2009-10-06 01:00:01] 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".

------------------------------------------------------------------------
[2009-09-28 06:57:50] jani@php.net

From php.ini-dist:

[Pcre]
;PCRE library backtracking limit.
;pcre.backtrack_limit=100000

;PCRE library recursion limit. 
;Please note that if you set this value to a high number you may consume
all 
;the available process stack and eventually crash PHP (due to reaching
the 
;stack size limit imposed by the Operating System).
;pcre.recursion_limit=100000

So you should tune these to be such that it won't crash anymore.

------------------------------------------------------------------------
[2009-09-28 05:26:37] donquixote dot phplist at googlemail dot com

Description:
------------
I found a regex / text combination that causes my apache to crash /
restart with preg_replace. The example is a reduced version of Drupal's
CSS compression regex.

The regex is not overly complex, and the text is not overly long.

Reproducing this depends on system configuration: On my webspace it does
not crash.
But, on my localhost it always crashes with this regex / text
combination. Removing a few letters in the text (no matter which) makes
the bug not happen.

More info in the linked file.

So:
It seems that preg_replace is not the most robust piece of code. No
matter what you feed it, it should never ever crash!

And, btw:
I was going to report this as a comment on
http://bugs.php.net/bug.php?id=46551, but the
comment form results in an
error page.
("Authentication failed: Incorrect username 
Warning: Cannot modify header information - headers already sent by
(output started at /home/Web/sites/php-bugs-web/include/auth.inc:30) in
/home/Web/sites/php-bugs-web/bug.php on line 232")

Reproduce code:
---------------
standalone script at
http://drupal.org/files/issues/test.php__1.txt

posted here
http://drupal.org/node/444228#comment-2089300

Expected result:
----------------
preg_replace should do its job (compressing the CSS).
Or show a meaningful error message, if there is a valid reason why this
is not possible.

Actual result:
--------------
Apache crash / restart, with no useful error message in error.log,
except the usual restart messages.


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=49697&edit=1


Thread (4 messages)

« previous php.bugs (#151740) next »