Bug #51581 [Opn->Asn]: getDefaultProperties incorrect for static properties
| From: | mike@php.net | Date: | Wed, 12 May 2010 13:45:59 +0000 |
| Subject: | Bug #51581 [Opn->Asn]: getDefaultProperties incorrect for static properties | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-150392@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51581&edit=1
ID: 51581
Updated by: mike@php.net
Reported by: ChadFulton at gmail dot com
Summary: getDefaultProperties incorrect for static properties
-Status: Open
+Status: Assigned
Type: Bug
Package: Reflection related
Operating System: Mac OSx 10.6
PHP Version: 5.3.2
-Assigned To:
+Assigned To: dmitry
New Comment:
Dmitry, could you please review the fix-refs-to-default-static-members
patch?
Thank you.
Previous Comments:
------------------------------------------------------------------------
[2010-05-12 15:45:35] mike@php.net
The following patch has been added/updated:
Patch Name: fix-reflection-of-default-static-members
Revision: 1273671935
URL:
http://bugs.php.net/patch-display.php?bug=51581&patch=fix-reflection-of-default-static-members&revision=1273671935
------------------------------------------------------------------------
[2010-05-12 15:42:00] mike@php.net
The following patch has been added/updated:
Patch Name: fix-refs-to-default-static-members
Revision: 1273671720
URL:
http://bugs.php.net/patch-display.php?bug=51581&patch=fix-refs-to-default-static-members&revision=1273671720
------------------------------------------------------------------------
[2010-04-17 02:24:07] ChadFulton at gmail dot com
Description:
------------
The array ReflectionClass's getDefaultProperties() method changes for
static
properties, depending upon what value the static property currently
holds.
I suppose there is an argument to be made that this is expected/desired,
since
static properties are meant to hold across all instances of the class.
However, it
doesn't seem like it necessarily fits as part of a function to get the
*default*
property.
Test script:
---------------
<?php
class foo {
static public $bar = 'true default value';
}
$r = new ReflectionClass('foo');
print_r($r->getDefaultProperties());
foo::$bar = 'new static value, no longer default though';
print_r($r->getDefaultProperties());
?>
Expected result:
----------------
Array
(
[bar] => true default value
)
Array
(
[bar] => true default value
)
Actual result:
--------------
Array
(
[bar] => true default value
)
Array
(
[bar] => new static value, no longer default though
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51581&edit=1