ID:               38636
 User updated by:  foobar at dodgeit dot com
 Reported By:      foobar at dodgeit dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: FreeBSD 6.1
 PHP Version:      5.1.5
 New Comment:

Sorry, I reversed expected and actual results.


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

[2006-08-29 01:03:52] foobar at dodgeit dot com

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.



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


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

Reply via email to