Hi,
Matt's approach works also for your usecase, casting to array returns
all the properties of the class and base classes, but it has some
problems: for private properties the class name is added before the
property name, and for protected properties * is added, both things
added are between null
matt.. that's public properties on a single class - see the usecase
use case:
mwil...@mattw-mac:~$ php -r 'class a { public $a, $b, $c, $d; public
function __sleep() { return array_diff( array_keys( (array) $this),
array("b","c")); } } $a = new a; var_dump($a->__sleep());'
array(2) {
[0]=>
mwil...@mattw-mac:~$ php -r 'class a { public $a, $b, $c, $d; public
function __sleep() { return array_diff( array_keys( (array) $this),
array("b","c")); } } $a = new a; var_dump($a->__sleep());'
array(2) {
[0]=>
string(1) "a"
[3]=>
string(1) "d"
}
On May 31, 2009, at 8:46 PM, Nathan
Matt Wilson wrote:
get_class_vars + array_diff
cheers but nope; as the manual says
"Returns an associative array of default public properties of the class"
need private and inherited private
On May 31, 2009, at 8:04 PM, Nathan Rixham wrote:
Hi All,
hoping somebody can help me here..
I ne
get_class_vars + array_diff
On May 31, 2009, at 8:04 PM, Nathan Rixham wrote:
Hi All,
hoping somebody can help me here..
I need to implement an inverted __sleep method, by which I mean to
specify what variables should not be included.
use case:
// TODO code return instance properties e
Hi All,
hoping somebody can help me here..
I need to implement an inverted __sleep method, by which I mean to
specify what variables should not be included.
use case:
I've tried using get_object_vars($this), and ReflectionObject($this)
both of which don't include all the properties of the in
Stanislav Malyshev kirjoitti:
Hi!
No, it's not fixed. Just needs some infinite recursion protection plus
moving the (or rather adding it also) init of tzcache into GINIT.
Attached is the patch that seems to do the trick for me. Any objections?
Looks fine by me. Just commit to all branches..