From: john at supernerd dot com Operating system: Windows 2000 PHP version: 4.3.4 PHP Bug Type: PCRE related Bug description: Preg_replace cannot handle ticks(')
Description: ------------ returns an error of Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Documents and Settings\john\Desktop\ttms desktop\php\gui\Smarty_Compiler.class.php(288) : regexp code on line 2 Reproduce code: --------------- $ldq = preg_quote('{', '!'); $rdq = preg_quote('}', '!'); $search = "!{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}!s"; $source_content = preg_replace($search.'e', "'" . '{' . 'php' . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'" . '}' . "'", "a {literal}b{/literal}c{php}d;s{/php}e{* hello's *}"); Expected result: ---------------- a{php}c{php}e{php} Actual result: -------------- Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Documents and Settings\john\Desktop\ttms desktop\php\index.php(17) : regexp code on line 2 Fatal error: Failed evaluating code: '{php' . str_repeat(" ", substr_count('{* hello''s *}', " ")) .'}' in C:\Documents and Settings\john\Desktop\ttms desktop\php\index.php on line 17 -- Edit bug report at http://bugs.php.net/?id=27299&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27299&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27299&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27299&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27299&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27299&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27299&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27299&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27299&r=support Expected behavior: http://bugs.php.net/fix.php?id=27299&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27299&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27299&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27299&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27299&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27299&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27299&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27299&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27299&r=float