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

From: Date: Wed, 18 Feb 2004 05:44:52 +0000
Subject: #27299 [Fbk->Opn]: Preg_replace cannot handle ticks(')
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-55122@lists.php.net to get a copy of this message
 ID:               27299
 User updated by:  john at supernerd dot com
 Reported By:      john at supernerd dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         PCRE related
 Operating System: Windows 2000
 PHP Version:      4.3.4
 New Comment:

I found that only with magic_quotes_sybase on did the error occur.  I
was then able to work around it. I will try the cvs snapshot tomorrow
and let you know what happens.


Previous Comments:
------------------------------------------------------------------------

[2004-02-17 23:16:49] sniper@php.net

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..


------------------------------------------------------------------------

[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


Thread (6 messages)

« previous php.bugs (#55122) next »