note 104992 modified in reflectionmethod.invoke by danbrown

From: Date: Thu, 21 Jul 2011 15:59:26 +0000
Subject: note 104992 modified in reflectionmethod.invoke by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181753@lists.php.net to get a copy of this message
Seems that Reflection doesn`t resolve late static bindings - var_dump will show "string 'a' (length=1)". <?php class ParentClass { protected static $a = 'a'; static public function init() { return static::$a; } } class ChildClass extends ParentClass { protected static $a = 'b'; } $r = new ReflectionClass('ChildClass'); var_dump($r->getMethod('init')->invoke(null)); ?> --was-- Seems that Reflection doesn`t resolve late static bindings - var_dump will show "string 'a' (length=1)". class ParentClass { protected static $a = 'a'; static public function init() { return static::$a; } } class ChildClass extends ParentClass { protected static $a = 'b'; } $r = new ReflectionClass('ChildClass'); var_dump($r->getMethod('init')->invoke(null)); http://php.net/manual/en/reflectionmethod.invoke.php

« previous php.notes (#181753) next »