ID: 47376 Updated by: fel...@php.net Reported By: pahan at hubbitus dot spb dot su -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Linux PHP Version: 5.3.0beta1 New Comment:
It isn't a PHP bug. See bug#33468, bug#39387. Thanks. Previous Comments: ------------------------------------------------------------------------ [2009-02-12 22:51:08] pahan at hubbitus dot spb dot su Sorry, sorry. Off course line "$text = file();" in reproduce code unnecessary. Please remove it. ------------------------------------------------------------------------ [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