Bug #51581 [PATCH]: getDefaultProperties incorrect for static properties
Edit report at http://bugs.php.net/bug.php?id=51581&edit=1
ID: 51581
Patch added by: mike@php.net
Reported by: ChadFulton at gmail dot com
Summary: getDefaultProperties incorrect for static properties
Status: Open
Type: Bug
Package: Reflection related
Operating System: Mac OSx 10.6
PHP Version: 5.3.2
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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
Thread (8 messages)