Doc #63370 [Com]: ReflectionCLass::getDefaultProperties() return is incorrect for static properti
| From: | skewl at gmail dot com | Date: | Sun, 23 Dec 2012 07:27:46 +0000 |
| Subject: | Doc #63370 [Com]: ReflectionCLass::getDefaultProperties() return is incorrect for static properti | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9311@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
Comment by: skewl at gmail dot com
Reported by: dimzav at gmail dot com
Summary: ReflectionCLass::getDefaultProperties() return is
incorrect for static properti
Status: Open
Type: Documentation Problem
Package: Reflection related
Operating System: Win 7 x64
PHP Version: 5.3.18
Block user comment: N
Private report: N
New Comment:
from TangJun website platform of that moment,http://www.mbtukshop.co.uk/ they have equal and in insult her
school is and west Pacific university
Previous Comments:
------------------------------------------------------------------------
[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