Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10233 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79989 invoked by uid 1010); 1 Jun 2004 20:44:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 79940 invoked from network); 1 Jun 2004 20:44:54 -0000 Received: from unknown (HELO d7.sfo.snocap.com) (66.125.73.139) by pb1.pair.com with SMTP; 1 Jun 2004 20:44:54 -0000 Received: from RICKPC ([192.168.42.10]) (authenticated bits=0) by d7.sfo.snocap.com (8.12.10/8.12.10) with ESMTP id i51KfC8h005922 for ; Tue, 1 Jun 2004 13:41:13 -0700 Message-ID: <200406012041.i51KfC8h005922@d7.sfo.snocap.com> To: Date: Tue, 1 Jun 2004 13:45:39 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 In-Reply-To: <200406011836.i51Iar8h005221@d7.sfo.snocap.com> Thread-Index: AcRICARS6DWsd5C5QvO8fkjKrTaTlwAEQHhw Subject: RE: [PHP-DEV] Overloaded property access From: rick@snocap.com ("Rick Fletcher") References: <200406011836.i51Iar8h005221@d7.sfo.snocap.com> 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:rick@snocap.com] > Sent: Tuesday, June 01, 2004 11:41a > To: internals@lists.php.net > 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. > > > 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 > >