Bug #52676 [Fbk->Bgs]: Eval will crash script when function inside returns a string to be eval'ed
| From: | aharvey@php.net | Date: | Tue, 24 Aug 2010 09:16:45 +0000 |
| Subject: | Bug #52676 [Fbk->Bgs]: Eval will crash script when function inside returns a string to be eval'ed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153735@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52676&edit=1
ID: 52676
Updated by: aharvey@php.net
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
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: any
PHP Version: 5.3.3
Block user comment: N
New Comment:
Glad it's working. :)
Not a PHP bug -> closing.
Previous Comments:
------------------------------------------------------------------------
[2010-08-24 10:30:23] wolff dot schetula at gmail dot com
xdebug is activated. Without it the script works fine :)
------------------------------------------------------------------------
[2010-08-24 02:35:03] felipe@php.net
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