Annotation of embedaddon/php/ext/spl/tests/bug45622.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SPL: Bug #45622 (isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PROPS set
! 3: --FILE--
! 4: <?php
! 5:
! 6: class C extends ArrayObject {
! 7: public $p = 'object property';
! 8: }
! 9:
! 10: $ao = new C(array('p'=>'array element'));
! 11: $ao->setFlags(ArrayObject::ARRAY_AS_PROPS);
! 12:
! 13: echo "\n--> Access the real property:\n";
! 14: var_dump(isset($ao->p));
! 15: var_dump($ao->p);
! 16:
! 17: echo "\n--> Remove the real property and access the array element:\n";
! 18: unset($ao->p);
! 19: var_dump(isset($ao->p));
! 20: var_dump($ao->p);
! 21:
! 22: echo "\n--> Remove the array element and try access again:\n";
! 23: unset($ao->p);
! 24: var_dump(isset($ao->p));
! 25: var_dump($ao->p);
! 26:
! 27: echo "\n--> Re-add the real property:\n";
! 28: $ao->p = 'object property';
! 29: var_dump(isset($ao->p));
! 30: var_dump($ao->p);
! 31: ?>
! 32: --EXPECTF--
! 33:
! 34: --> Access the real property:
! 35: bool(true)
! 36: %unicode|string%(15) "object property"
! 37:
! 38: --> Remove the real property and access the array element:
! 39: bool(true)
! 40: %unicode|string%(13) "array element"
! 41:
! 42: --> Remove the array element and try access again:
! 43: bool(false)
! 44:
! 45: Notice: Undefined index: p in %s on line %d
! 46: NULL
! 47:
! 48: --> Re-add the real property:
! 49: bool(true)
! 50: %unicode|string%(15) "object property"
! 51:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>