Edit report at http://bugs.php.net/bug.php?id=52676&edit=1
ID: 52676
Comment by: wolff dot schetula at gmail dot com
Reported by: wolff dot schetula at gmail dot com
Summary: Eval will crash script when function inside returns
a string to be eval'ed
Status: Feedback
Type: Bug
Package: *General Issues
Operating System: any
PHP Version: 5.3.3
Block user comment: N
New Comment:
xdebug is activated. Without it the script works fine :)
Previous Comments:
------------------------------------------------------------------------
[2010-08-24 02:35:03] [email protected]
Are you using any Zend Extension? I cannot reproduce any crash on 5.2,
5.3, trunk.
------------------------------------------------------------------------
[2010-08-23 10:24:45] wolff dot schetula at gmail dot com
Description:
------------
The code below shows the problem. Any return statement inside the
function that is supposed to create the code to be evaluated will crash
PHP. Not even Apache will send a header anymore. A white page appears.
If the returned string is stored i a variable first it will work fine.
The quickest fix is a (string) cast inside the eval function.
eval((string)foo());
Test script:
---------------
function foo() {
return 'echo time();';
}
eval(foo());
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52676&edit=1