Annotation of embedaddon/php/Zend/tests/bug32660.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #32660 (Assignment by reference causes crash when field access is overloaded (__get))
! 3: --FILE--
! 4: <?php
! 5: class A
! 6: {
! 7: public $q;
! 8:
! 9: function __construct()
! 10: {
! 11: $this->q = 3;//array();
! 12: }
! 13:
! 14: function __get($name)
! 15: {
! 16: return $this->q;
! 17: }
! 18: }
! 19:
! 20: $a = new A;
! 21:
! 22: $b = "short";
! 23: $c =& $a->whatever;
! 24: $c = "long";
! 25: print_r($a);
! 26: $a->whatever =& $b;
! 27: $b = "much longer";
! 28: print_r($a);
! 29: ?>
! 30: --EXPECTF--
! 31: Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 20
! 32: A Object
! 33: (
! 34: [q] => 3
! 35: )
! 36:
! 37: Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 23
! 38:
! 39: Fatal error: Cannot assign by reference to overloaded object in %sbug32660.php on line 23
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>