ID: 33200
Updated by: [EMAIL PROTECTED]
Reported By: astax_t at gorodok dot net
-Status: Open
+Status: Assigned
Bug Type: PCRE related
-Operating System: Windows
+Operating System: *
-PHP Version: 4.3.11
+PHP Version: 5.*, 4.*
-Assigned To:
+Assigned To: sniper
New Comment:
I stand corrected, fix coming up..
Previous Comments:
------------------------------------------------------------------------
[2005-05-31 12:53:41] astax_t at gorodok dot net
And additionally, it makes impossible to use preg_replace with /e
modifier in certain situations. When subject string comes from external
source and so can contain some variables, like in my example.
I still insist that it's a bug.
Thank you.
------------------------------------------------------------------------
[2005-05-31 12:49:18] astax_t at gorodok dot net
I know how magic_quotes_sybase works, but I state that it should NOT
affect /e modifier in regular expressions. The same as magic_quotes_gpc
and magic_quotes_runtime doesn't affect this.
------------------------------------------------------------------------
[2005-05-31 12:43:22] [EMAIL PROTECTED]
RTFM:
"If magic_quotes_sybase is also on, a single-quote is escaped with a
single-quote instead of a backslash."
------------------------------------------------------------------------
[2005-05-31 12:36:09] astax_t at gorodok dot net
Description:
------------
When magic_quotes_sybase is On, this also affects how apostrophes are
escaped in preg_replace with /e modifier. See example.
In example code I specifically included a string with $ inside to point
why it's impossible to use double quotes around \\1 in second parameter.
Reproduce code:
---------------
$str = 'some \'$sample\' text';
$str = preg_replace("/(some.*text)/e", "strtoupper('\\1')", $str);
echo $str;
Expected result:
----------------
SOME '$SAMPLE' TEXT
Actual result:
--------------
Parse error: parse error in E:\test\web\a.php(4) : regexp code on line
1
Fatal error: preg_replace(): Failed evaluating code: strtoupper('some
''$sample'' text') in E:\test\web\a.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33200&edit=1