#24807 [Opn->Bgs]: Dereferencing objects and Property accesses with __get() and __set()

From: Date: Tue, 29 Jul 2003 12:26:18 +0000
Subject: #24807 [Opn->Bgs]: Dereferencing objects and Property accesses with __get() and __set()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44989@lists.php.net to get a copy of this message
 ID:               24807
 Updated by:       sfox@php.net
 Reported By:      Bertrand dot Willm at laposte dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows XP
 PHP Version:      5.0.0b1 (beta1)
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

Suggest you read ZEND_CHANGES :)


Previous Comments:
------------------------------------------------------------------------

[2003-07-25 15:35:14] Bertrand dot Willm at laposte dot net

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



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24807&edit=1



Thread (4 messages)

« previous php.bugs (#44989) next »