#31822 [Bgs]: __FUNCTION__ magic constant doesn't work in eval()
ID: 31822
User updated by: clewis at myfonts dot com
Reported By: clewis at myfonts dot com
Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: RedHat Enterprise 3
PHP Version: 5.0.3
New Comment:
I see. I thought the eval() was run in the current
context, but in fact it runs in its own completely
separate PHP context? But that doesn't make sense since
you can make variable assignments etc within the eval().
It seems if one can make use of pre-existing variables
within the eval, it should also know it's inside a
function.
Previous Comments:
------------------------------------------------------------------------
[2005-02-03 17:21:52] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
In your example there is no function in your eval\'d code.
------------------------------------------------------------------------
[2005-02-03 00:35:22] clewis at myfonts dot com
Description:
------------
The __FUNCTION__ magic constant returns nothing when used in eval()'d
code. __FILE__ and __LINE__ work as expected.
Reproduce code:
---------------
<?php
function whatFunctionAmI()
{
eval("print 'the function is: ' . __FUNCTION__;");
}
whatFunctionAmI();
?>
Expected result:
----------------
the function is: whatFunctionAmI
Actual result:
--------------
the function is:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31822&edit=1
Thread (3 messages)