Doc #63370 [Opn->Csd]: ReflectionCLass::getDefaultProperties() return is incorrect for static properti
| From: | googleguy@php.net | Date: | Sat, 19 Jan 2013 14:46:00 +0000 |
| Subject: | Doc #63370 [Opn->Csd]: ReflectionCLass::getDefaultProperties() return is incorrect for static properti | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9447@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63370&edit=1
ID: 63370
Updated by: googleguy@php.net
Reported by: dimzav at gmail dot com
Summary: ReflectionCLass::getDefaultProperties() return is
incorrect for static properti
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Reflection related
Operating System: Win 7 x64
PHP Version: 5.3.18
-Assigned To:
+Assigned To: googleguy
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2013-01-19 14:45:30] googleguy@php.net
Automatic comment from SVN on behalf of googleguy
Revision: http://svn.php.net/viewvc/?view=revision&revision=329237
Log: Added note to documentat that this method is only intended to work with internal classes for
getting the default value of static class properties.
Fixes bug #63370 also references bug #51581
------------------------------------------------------------------------
[2012-10-28 11:50:44] cataphract@php.net
Should be documented only to work with internal classes. Otherwise, Won't Fix (see the
justification in bug #51581).
------------------------------------------------------------------------
[2012-10-26 17:49:38] dimzav at gmail dot com
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.
------------------------------------------------------------------------
[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