note 61658 modified in language.oop5.reflection by danbrown

From: Date: Wed, 16 Sep 2009 16:19:02 +0000
Subject: note 61658 modified in language.oop5.reflection by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160723@lists.php.net to get a copy of this message
Beware, the Reflection reflects only the information right after compile time based on the definitions, not based on runtime objects. Might be obvious, wasn't for me, until the app throws the exception at my head. Example: <?php class A { public $a = null; function set() { $this->foo = 'bar'; } } $a = new A; $a->set(); // works fine $Reflection = new ReflectionProperty($a, 'a'); // throws exception $Reflection = new ReflectionProperty($a, 'foo'); ?> --was-- Beware, the Reflection reflects only the information right after compile time based on the definitions, not based on runtime objects. Might be obvious, wasn't for me, until the app throws the exception at my head. Example: <?php class A { public $a = null; function set() { $this->foo = 'bar'; } } $a = new A; $a->set(); // works fine $Reflection = new ReflectionProperty($a, 'a'); // throws exception $Reflection = new ReflectionProperty($a, 'foo'); ?> http://php.net/manual/en/language.oop5.reflection.php

« previous php.notes (#160723) next »