Annotation of embedaddon/php/Zend/tests/bug37667.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #37667 (Object is not added into array returned by __get)
! 3: --FILE--
! 4: <?php
! 5:
! 6: class Test
! 7: {
! 8: protected $property = array('foo' => 'bar');
! 9:
! 10: function __get($name)
! 11: {
! 12: return $this->property;
! 13: }
! 14: }
! 15:
! 16: $obj = new Test;
! 17:
! 18: var_dump($obj->property['foo']);
! 19: var_dump($obj->property[2]);
! 20:
! 21: var_dump($obj);
! 22:
! 23: $obj->property[] = 1;
! 24: $obj->property[] = 2;
! 25:
! 26: var_dump($obj);
! 27:
! 28: ?>
! 29: ===DONE===
! 30: --EXPECTF--
! 31: string(3) "bar"
! 32:
! 33: Notice: Undefined offset: 2 in %sbug37667.php on line 16
! 34: NULL
! 35: object(Test)#%d (1) {
! 36: ["property":protected]=>
! 37: array(1) {
! 38: ["foo"]=>
! 39: string(3) "bar"
! 40: }
! 41: }
! 42:
! 43: Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 20
! 44:
! 45: Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 21
! 46: object(Test)#%d (1) {
! 47: ["property":protected]=>
! 48: array(1) {
! 49: ["foo"]=>
! 50: string(3) "bar"
! 51: }
! 52: }
! 53: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>