|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-29 01:07 UTC] foobar at dodgeit dot com
[2006-08-29 07:39 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 03:00:01 2025 UTC |
Description: ------------ Consider the following code: $foo = new A; $foo->bar = 'bar'; echo $foo->bar; Assume A defines __get. Behavior of the last line is different depending on whether A defines __set. If __set is not defined, then the last line won't call __get. If __set is defined, __get will be called. Reproduce code: --------------- <?php class A { public function __get($prop) { echo "getting\n"; } } $a = new A; $a->foo = 'foo'; echo $a->foo."\n"; ?> ------ <?php class A { public function __get($prop) { echo "getting\n"; } public function __set($prop, $val) { echo "setting\n"; } } $a = new A; $a->foo = 'foo'; echo $a->foo."\n"; ?> Expected result: ---------------- The first run produces: foo The second run produces: getting setting Actual result: -------------- Either 'getting' should be printed in both runs, or it should be not printed in either run.