From: alexis at m2osw dot com Operating system: Linux PHP version: 5.2.10 PHP Bug Type: PCRE related Bug description: Feels like .*? and /s is problematic, no output generated!
Description: ------------ I have a pregex that starts looks like this: /(?:<p.*?>)?\[.../s (The last ... is to be interpreted as an ellipsis) Removing the /s or the <p> tag before the \[ fixes the problem. Otherwise the preg_replace_callback() returns an empty string and never calls the callback. This is the case with several pages of data we have, although it is not easy for me to determine what triggers the problem. P.S. If the callback does not exist, the function has a shortcut and the input is immediately returned as is. Reproduce code: --------------- 1740 lines of code found as an attachment to that page: http://linux.m2osw.com/pcre_php_s_modifier_bug The main reason for the length is the HTML code, the failing code is just 1 line at the bottom. Expected result: ---------------- ($s == preg_replace_callback(...)) === TRUE since the callback should not be called with that HTML. Actual result: -------------- preg_replace_callback() returns NULL -- Edit bug report at http://bugs.php.net/?id=48938&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48938&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48938&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48938&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48938&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48938&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48938&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48938&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48938&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48938&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48938&r=support Expected behavior: http://bugs.php.net/fix.php?id=48938&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48938&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48938&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48938&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48938&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48938&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48938&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48938&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48938&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48938&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48938&r=mysqlcfg