ID: 48830
Comment by: sjoerd-php at linuxonly dot nl
Reported By: s dot coletta at unidata dot it
Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows/Ubuntu
PHP Version: 5.2.10
New Comment:
Thank you for your bug report.
The issue you report is not a bug. Both strings in your example look
like this:
define('A','C:\Dir\');
Note that the last single quote is escaped by the backslash. Passing
this to eval or putting this string in a PHP file will rightfully give a
parse error, because there is no ending quote.
Previous Comments:
------------------------------------------------------------------------
[2009-07-07 09:23:25] s dot coletta at unidata dot it
Description:
------------
Eval() makes a wrong parsing of a string ending with \\' or \'
The "Reproduce code" will not fail if you remove the ending \\ or \
like:
$str = "define('A','C:\\Dir');"; or
$str = "define('A','C:\Dir');";
Reproduce code:
---------------
$str = "define('A','C:\\Dir\\');";
eval($str);
or
$str = "define('A','C:\Dir\');";
eval($str);
Expected result:
----------------
No warnings or errors.
Just this statement executed:
define('A','C:\Dir\');
Actual result:
--------------
For both examples provided the result is the same:
Warning: Unexpected character in input: ''' (ASCII=39) state=1 in
/test.php(3) : eval()'d code on line 1
Parse error: syntax error, unexpected ':' in /test.php(3) : eval()'d
code on line 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48830&edit=1