Edit report at http://bugs.php.net/bug.php?id=51581&edit=1

 ID:               51581
 Comment by:       ChadFulton at gmail dot com
 Reported by:      ChadFulton at gmail dot com
 Summary:          getDefaultProperties incorrect for static properties
 Status:           Assigned
 Type:             Bug
 Package:          Reflection related
 Operating System: Mac OSx 10.6
 PHP Version:      5.3.2
 Assigned To:      dmitry

 New Comment:

Thanks for taking this issue up!


Previous Comments:
------------------------------------------------------------------------
[2010-05-12 15:45:58] m...@php.net

Dmitry, could you please review the fix-refs-to-default-static-members
patch?



Thank you.

------------------------------------------------------------------------
[2010-05-12 15:45:35] m...@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] m...@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

Reply via email to