|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-29 07:26 UTC] sfox@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
Description: ------------ I try to use the following notation: $object->property1->property2 = 'value'; when property1 and property2 are properties we access trow __get and __set methods. calling __get with property1 return an object that defined __get and __set methods. but there is a warning explaining the object doesn't support property references. Reproduce code: --------------- <?php class CBaseClass { private $text = 'default'; function __Get() { return $this->text; } function __Set($name, $value) { $this->text = $value; } } class CExtClass { private $baseObject; function __construct() { $this->baseObject = new CBaseClass(); } function __Get() { return $this->baseObject; } } $extObject = new CExtClass(); echo $extObject->extProperty->baseProperty, '<br>'; $extObject->extProperty->baseProperty = 'new'; echo $extObject->extProperty->baseProperty, '<br>'; ?> Expected result: ---------------- default new Actual result: -------------- default Warning: This object doesn't support property references in c:\sitesweb\www\test.php5 on line 22 default