Bug #15241 Updated: eval() is not allow evaluating code from constants
| From: | hholzgra@php.net | Date: | Mon, 17 Jun 2002 21:01:09 +0000 |
| Subject: | Bug #15241 Updated: eval() is not allow evaluating code from constants | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-10943@lists.php.net to get a copy of this message | ||
ID: 15241
Updated by: hholzgra@php.net
Reported By: flying@dom.natm.ru
-Status: Open
+Status: Analyzed
Bug Type: Scripting Engine problem
Operating System: all
PHP Version: 4.1.1
-Assigned To:
+Assigned To: hholzgra
New Comment:
yet another locale dependant ZE bug only affecting
non-latin locales (like cyrillic)
for now either use lowercase constants
or setlocale(LC_ALL, "C")
Previous Comments:
------------------------------------------------------------------------
[2002-01-27 06:46:32] flying@dom.natm.ru
Check out these simple examples:
Example 1:
-----------------------------------------------------
<?php
function getCode()
{
return("echo 'hello world!';");
};
eval(getCode());
?>
-----------------------------------------------------
Result of executing whis example will be a string 'hello world!' as
expected.
Example 2:
-----------------------------------------------------
<?php
define('PHP_CODE','getCode()');
function getCode()
{
return("echo 'hello world!';");
};
eval(PHP_CODE);
?>
-----------------------------------------------------
As you can see - i just move code from eval() into constant
and substitute it with constant name instead of actual code into eval()
statement.
But result of executing this example is:
Parse error: parse error in test.php(9) : eval()'d code on line 1
Tested with both 4.0.6 and 4.1.1 on windows 2000 and linux.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15241&edit=1