#27299 [Opn->Fbk]: Preg_replace cannot handle ticks(')

From: Date: Wed, 18 Feb 2004 04:16:49 +0000
Subject: #27299 [Opn->Fbk]: Preg_replace cannot handle ticks(')
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-55116@lists.php.net to get a copy of this message
ID: 27299 Updated by: sniper@php.net Reported By: john at supernerd dot com -Status: Open +Status: Feedback Bug Type: PCRE related Operating System: Windows 2000 PHP Version: 4.3.4 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Works fine in win32 using latest CVS snapshot.. Previous Comments: ------------------------------------------------------------------------ [2004-02-17 21:59:21] john at supernerd dot com yeah, I tested on mac/linux. It only fails on windows. ------------------------------------------------------------------------ [2004-02-17 21:27:30] gschlossnagle@php.net works fine on mac/linux. ------------------------------------------------------------------------ [2004-02-17 21:19:45] john at supernerd dot com 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 this bug report at http://bugs.php.net/?id=27299&edit=1

« previous php.bugs (#55116) next »