ID:               47376
 Comment by:       pahan at hubbitus dot spb dot su
 Reported By:      pahan at hubbitus dot spb dot su
 Status:           Open
 Bug Type:         PCRE related
 Operating System: Linux
 PHP Version:      5.3.0beta1
 New Comment:

Sorry, sorry. Off course line "$text = file();" in reproduce code
unnecessary. Please remove it.


Previous Comments:
------------------------------------------------------------------------

[2009-02-12 22:12:28] pahan at hubbitus dot spb dot su

Description:
------------
On text, where search pattern repeated many times (>643 times by test)
php segfaulted (Core dump you may download here:
http://ru.bir.ru/_temp/php-pcre-bug/core.8729 ) on preg_replace.

So, if we reduce length of test text (
http://ru.bir.ru/_temp/php-pcre-bug/pcre_bug.text ) on 1 line, or just
limit repetition on 1 - it is worked.

All Zend-modules was disabled.

Reproduce code:
---------------
<?
$text = file_get_contents('pcre_bug.text');

echo preg_replace('/(@@ -[\d,]+ \+[\d,]+ @@\s){2,}/s', '-some data-',
$text); //Segmentation fault
$text = file();

# Interesting:
#echo preg_replace('/(@@ -[\d,]+ \+[\d,]+ @@\s){2,642}/s', '-some
data-', $text); //Work, but result it is not same as needed.
#echo preg_replace('/(@@ -[\d,]+ \+[\d,]+ @@\s){2,643}/s', '-some
data-', $text); //PHP Warning:  preg_replace(): Compilation failed:
regular expression is too large at offset 33
?>

Expected result:
----------------
Work as when text is less.

Actual result:
--------------
Segmentation fault


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


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

Reply via email to