Bug #67922 [NEW]: Member function not found when dereferencing in write-context

From: Date: Thu, 28 Aug 2014 08:42:27 +0000
Subject: Bug #67922 [NEW]: Member function not found when dereferencing in write-context
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187311@lists.php.net to get a copy of this message
From: arjen at react dot com Operating system: PHP version: master-Git-2014-08-28 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Member function not found when dereferencing in write-context Description: ------------ Not sure about the summary, but I don't think this is intended behaviour (I double checked the uniform_variable_syntax and AST RFC) OR the error should be fixed. Test script: --------------- <?php class B { public function __get($name) { $this->__set($name, new C); return $this->$name; } public function __set($name, $value) { $this->$name = $value; } } class C { public function test() { return new D; } } class D { public $d; } $b = new B; $b->c->test()->d = 'waa'; echo 'first call success' . PHP_EOL; $b->c->test(); echo 'just a call to test() works' . PHP_EOL; $b->c->test()->d = 'waa'; echo 'second call success' . PHP_EOL; Expected result: ---------------- first call success just a call to test() works second call success Actual result: -------------- first call success just a call to test() works Fatal error: Call to a member function test() on unknown in /home/arjen/phpng/testcase.php on line 38 -- Edit bug report at https://bugs.php.net/bug.php?id=67922&edit=1 --

« previous php.bugs (#187311) next »