ID: 39934 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Irrelevant PHP Version: 4.4.4 New Comment:
>So, you mean we cannot use pcre, does give an alternative ? I don't get the question, sorry. >Or is the bug to push in another location ? To PCRE developers, probably? Previous Comments: ------------------------------------------------------------------------ [2006-12-22 22:12:51] [EMAIL PROTECTED] Thanks, That was the expected answer, just wanted to report back to primary pear user. So, you mean we cannot use pcre, does give an alternative ? Or is the bug to push in another location ? ------------------------------------------------------------------------ [2006-12-22 21:42:50] [EMAIL PROTECTED] Stack overflow in PCRE has been reported many times and is not really a problem in PHP, though newer PHP versions (5.2.0+) have a workaround for this problem. See pcre.backtrack_limit @ http://php.net/pcre ------------------------------------------------------------------------ [2006-12-22 20:35:40] [EMAIL PROTECTED] Description: ------------ It is a reduction of http://pear.php.net/bugs/bug.php?id=7908 This test is breaking by repeat=437 by php-4.4.4 Windows NT and 10000 by php 5.1.6 linux FC5 It's not breaking if you give ok=1 or nomatch=1 or reduce enough repeat. Note: it's php version irrelevent , but your sytem forced to choose some. Reproduce code: --------------- <?php error_reporting(E_ALL); ini_set('display_errors', true); function process($matches) { return $matches[0]; } $regex = isset($_GET['ok']) ? '#X(.*?)X#' : '#X((.)*?)X#'; $around = isset($_GET['nomatch']) ? 'Y' : 'X'; $repeat = isset($_GET['repeat']) ? (int) $_GET['repeat'] : 10000; $source = $around . str_repeat('a', $repeat) . $around; $transform = preg_replace_callback($regex, 'process', $source); echo '---Text---' . strlen($source) . "\n"; echo "---Transform---" . strlen($transform) . "\n"; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39934&edit=1