From: Operating system: Ubuntu PHP version: 5.3SVN-2010-05-04 (SVN) Package: PCRE related Bug Type: Bug Bug description:preg_match returns zero if it hits backtracking limit
Description: ------------ According to the documentation, pcre_match should return FALSE on error: >From http://docs.php.net/manual/en/function.preg-match.php : << Return Values preg_match() returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match. preg_match_all() on the contrary will continue until it reaches the end of subject. preg_match() returns FALSE if an error occurred. >> Instead, it returns 0 (integer zero) -- see Felipe's comment on http://bugs.php.net/bug.php?id=51663&edit=2 for a check. Note that pcretest does report an error in this same case: $ pcretest PCRE version 7.8 2008-09-05 re> /(.+)+:/ data> \q10a:bbb Error -8 data> Test script: --------------- <? ini_set('pcre.backtrack_limit', 10); print_r( preg_match('/(.+)+:/','a:bbb') === FALSE ? 'pass' : 'fail' ); Expected result: ---------------- pass Actual result: -------------- fail -- Edit bug report at http://bugs.php.net/bug.php?id=51741&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51741&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51741&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51741&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51741&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51741&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51741&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51741&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51741&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51741&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51741&r=support Expected behavior: http://bugs.php.net/fix.php?id=51741&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51741&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51741&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51741&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51741&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51741&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51741&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51741&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51741&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51741&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51741&r=mysqlcfg
