[PHP-BUG] Bug #71250 [NEW]: ReflectionFunction getStaticVariables returns the variables defined in "use"
[email protected] ("mfaust at usinternet dot com")
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
From: mfaust at usinternet dot com
Operating system: Linux
PHP version: 5.6.16
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionFunction getStaticVariables returns the variables defined in "use"
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 bug report at https://bugs.php.net/bug.php?id=71250&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71250&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71250&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71250&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71250&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71250&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71250&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71250&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71250&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71250&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71250&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71250&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71250&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71250&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71250&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71250&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71250&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71250&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71250&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71250&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71250&r=mysqlcfg