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

From: Date: Thu, 28 Aug 2014 22:20:43 +0000
Subject: Bug #67922 [Asn->Csd]: Member function not found when dereferencing in write-context
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187329@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67922&edit=1 ID: 67922 Updated by: nikic@php.net Reported by: arjen at react dot com Summary: Member function not found when dereferencing in write-context -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: master-Git-2014-08-28 (Git) Assigned To: nikic Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikic Revision: http://git.php.net/?p=php-src.git;a=commit;h=ae7e663330b241bf7906551f9e801223aa067dbf Log: Fix bug #67922 Previous Comments: ------------------------------------------------------------------------ [2014-08-28 11:23:14] arjen at react dot com Reduced testcase: <?php class C { public function test() { return new stdClass; } } $b = new stdClass; $b->c = new C; $b->c->test()->d = 'waa'; ------------------------------------------------------------------------ [2014-08-28 08:42:26] arjen at react dot com 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 this bug report at https://bugs.php.net/bug.php?id=67922&edit=1

« previous php.bugs (#187329) next »