After sending this mail I went and searched the bugs database more thoroughly and found this very problem here: http://bugs.php.net/bug.php?id=28444.
My apologies. Rick > -----Original Message----- > From: Rick Fletcher [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 01, 2004 11:41a > To: [EMAIL PROTECTED] > Subject: [PHP-DEV] Overloaded property access > > I've just made use of overloaded property access for the > first time and > experienced some unexpected behavior. I just wanted to > verify that it was > the correct behavior with those who'd know best. > > <?php > > class One { > public function __construct() { > $this->two = new Two(); > } > > public function __set( $n, $v ) { > $GLOBALS[$n] = $v; > } > > public function __get( $n ) { > return $GLOBALS[$n]; > } > } > > class Two { > public $property = "default value"; > } > > $one = new One(); > > print( "\"" . $one->two->property . "\"n" ); > > $one->two->property = "new value"; > > ?> > > This produces: > ================= > $ php -f test.php > "default value" > PHP Fatal error: Cannot access undefined property for object with > overloaded property access in /home/fletch/test.php on line 24 > ================= > > Is it correct that $one->two->property should be read only? > > Thanks. > > Rick Fletcher > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php