Edit report at https://bugs.php.net/bug.php?id=63370&edit=1
ID: 63370
User updated by: dimzav at gmail dot com
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:
Reasons given are:
Of course it might be used in ext/Reflection but it would require
less-efficient and more-memory-consumption implementation which would affect
any php script which use classes with static properties.
I don't understand why performance issue should be excuse for bug. And I can't
add comments to that bug, so what else can I do? Only create new ticket for bug
which is evident and can't be excused by any performance reasons.
Previous Comments:
------------------------------------------------------------------------
[2012-10-26 17:32:49] hanskrentel at yahoo dot de
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.
------------------------------------------------------------------------
[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