Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10229 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35180 invoked by uid 1010); 1 Jun 2004 18:40:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 35156 invoked from network); 1 Jun 2004 18:40:33 -0000 Received: from unknown (HELO d7.sfo.snocap.com) (66.125.73.139) by pb1.pair.com with SMTP; 1 Jun 2004 18:40:33 -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 i51Iar8h005221 for ; Tue, 1 Jun 2004 11:36:53 -0700 Message-ID: <200406011836.i51Iar8h005221@d7.sfo.snocap.com> To: Date: Tue, 1 Jun 2004 11:41:14 -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 Thread-Index: AcRICARS6DWsd5C5QvO8fkjKrTaTlw== Subject: Overloaded property access From: rick@snocap.com ("Rick Fletcher") 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. 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