From: Bertrand dot Willm at laposte dot net
Operating system: Windows XP
PHP version: 5.0.0b1 (beta1)
PHP Bug Type: Class/Object related
Bug description: Dereferencing objects and Property accesses with __get() and __set()
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 bug report at http://bugs.php.net/?id=24807&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24807&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24807&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24807&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24807&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24807&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24807&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24807&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24807&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24807&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24807&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24807&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24807&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24807&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24807&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24807&r=gnused