Bug #71250 [Opn]: ReflectionFunction getStaticVariables returns the variables defined in "use"
| From: | laruence@php.net | Date: | Sat, 02 Jan 2016 07:36:19 +0000 |
| Subject: | Bug #71250 [Opn]: ReflectionFunction getStaticVariables returns the variables defined in "use" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198363@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71250&edit=1
ID: 71250
Updated by: laruence@php.net
Reported by: mfaust at usinternet dot com
Summary: ReflectionFunction getStaticVariables returns the
variables defined in "use"
Status: Open
Type: Bug
Package: Reflection related
Operating System: Linux
PHP Version: 5.6.16
-Assigned To:
+Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
There is no such info in run-time. thus I don't see a easy way to fix it, but maybe we could
fix this in 7.1.
Previous Comments:
------------------------------------------------------------------------
[2015-12-30 21:10:02] mfaust at usinternet dot com
Description:
------------
ReflectionFunction::getStaticVariables returns the variables defined in a "use" clause of
an anonymous function even though they are not specifically declared as "static" within
the function. This might be an internal implementation detail of how "use" works but they
should not be reported as "static" variables in terms of reflection.
Test script:
---------------
$var = 6;
$a = function() use ($var){
echo $var;
};
$reflected = new \ReflectionFunction($a);
var_export($reflected->getStaticVariables());
Expected result:
----------------
Should not have 'var' listed as a static variable.
array( )
Actual result:
--------------
Has 'var' listed as a static variable
array('var' => 6)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71250&edit=1