Edit report at https://bugs.php.net/bug.php?id=63370&edit=1

 ID:                 63370
 Comment by:         hanskrentel at yahoo dot de
 Reported by:        dimzav at gmail dot com
 Summary:            ReflectionCLass::getDefaultProperties() return is
                     incorrect for static properti
 Status:             Open
 Type:               Bug
 Package:            Reflection related
 Operating System:   Win 7 x64
 PHP Version:        5.3.18
 Block user comment: N
 Private report:     N

 New Comment:

Please do not create a duplicate of the existing issue #51581. There was a 
decision to not fix it for some reasons.

Also IMHO default values for global static class variables are as useful as 
getting default values for other global variables.

You might have more luck in requesting a general reflection features for 
variables - global ones, local ones, static ones and class static ones.


Previous Comments:
------------------------------------------------------------------------
[2012-10-26 14:01:45] dimzav at gmail dot com

Description:
------------
ReflectionCLass::getDefaultProperties() returns current value of static 
property, not the default one. I can't add comment to 
https://bugs.php.net/bug.php?id=51581 but it is evidently a bug and must be 
fixed.

Test script:
---------------
class A
{
    public static $a = 1;
}

A::$a = 2;

$reflectionCLass = new ReflectionClass('A');
$defaultProperties = $reflectionCLass->getDefaultProperties();
var_dump($defaultProperties);

Expected result:
----------------
Default value of $a static property is 1, it should be returned by 
ReflectionCLass::getDefaultProperties() instead of current value.

Actual result:
--------------
C:\OpenServer\modules\php\PHP-5.3.18\php.exe temp.php
array(1) {
  ["a"]=>
  int(2)
}



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63370&edit=1

Reply via email to