Bug #66423 [Fbk->NoF]: preg_match / preg_replace greedyness changes unpredictably with subject string

From: Date: Tue, 30 Dec 2014 10:42:14 +0000
Subject: Bug #66423 [Fbk->NoF]: preg_match / preg_replace greedyness changes unpredictably with subject string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189452@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66423&edit=1 ID: 66423 Updated by: php-bugs@lists.php.net Reported by: publi at web dot de Summary: preg_match / preg_replace greedyness changes unpredictably with subject string -Status: Feedback +Status: No Feedback Type: Bug Package: *Regular Expressions Operating System: Debian Linux PHP Version: Irrelevant Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2014-01-06 03:52:35] requinix@php.net Increase your pcre.backtrack_limit and try again. ------------------------------------------------------------------------ [2014-01-06 02:40:31] publi at web dot de Description: ------------ I am using a shared debian host where I cannot easily upgrade to a newer version of PHP myself, currently it is PHP Version 5.3.3-7+squeeze18 I currently experience the expected behavior at roughly 85% of the inputs: the preg_* modifiers "sU" make two ".*"s in the search string ungreedy. Otherwise, at least the 1st occurrence of ".*" is not greedy. Alterig it to ".*?" fixes the problem. Behavior reproducibly depended on the subject strings of the search in my tests. Since these are lengthy web pages, there is an archive with all source files at: http://omegawiki.purodha.net/test-M15/test-M15.tgz and the test script is also available to run at: http://omegawiki.purodha.net/test-M15/test-M15.php and more input files for additional tests ate at: http://omegawiki.purodha.net/test-M15/ If you want more information or additional tests, feel free to contact me via e-mail. Test script: --------------- See: http://omegawiki.purodha.net/test-M15/test-M15.tgz http://omegawiki.purodha.net/test-M15/test-M15.php Expected result: ---------------- file regex-1 regex-2 6028 1 1 6245 1 1 Actual result: -------------- file regex-1 regex-2 6028 1 1 6245 0 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66423&edit=1

« previous php.bugs (#189452) next »