From: [EMAIL PROTECTED]
Operating system: all
PHP version: 4.1.1
PHP Bug Type: Scripting Engine problem
Bug description: eval() is not allow evaluating code from constants
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 bug report at: http://bugs.php.net/?id=15241&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]