#39405 [Com]: regular expression breaking on strings >= 24999 characters

From: Date: Mon, 06 Nov 2006 20:48:03 +0000
Subject: #39405 [Com]: regular expression breaking on strings >= 24999 characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104487@lists.php.net to get a copy of this message
ID: 39405 Comment by: ludvig dot ericson at gmail dot com Reported By: spam at dragy dot de Status: Open Bug Type: PCRE related Operating System: Any PHP Version: 5.2.0 New Comment: This is because of limits intentionally set, see the ini setting pcre.backtrack_limit. Previous Comments: ------------------------------------------------------------------------ [2006-11-06 18:45:23] spam at dragy dot de Description: ------------ The following preg_replace breaks when the string is => 24999 characters. Works perfectly fine with 24998 characters and worked fine with any strings in PHP 5.1.5. Reproduce code: --------------- <?php $string = str_repeat('a', 100000); echo preg_replace('#(^.*|.*)(\[(php|html|noparse)\].*\[/\\3])(.*|.*$)#siUe', '', $string); ?> Expected result: ---------------- 100.000 times 'a' Actual result: -------------- nothing ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39405&edit=1

« previous php.bugs (#104487) next »