xref: /PHP-5.3/ext/spl/tests/bug45622b.phpt (revision 52cc098a)
1--TEST--
2Ensure fix to bug45622 doesn't cause __isset() to be called when ArrayObject::ARRAY_AS_PROPS is used.
3--FILE--
4<?php
5class UsesMagic extends ArrayObject {
6	function __get($n)     {  echo "In " . __METHOD__ . "!\n"; }
7	function __set($n, $v) {  echo "In " . __METHOD__ . "!\n"; }
8	function __isset($n)   {  echo "In " . __METHOD__ . "!\n"; }
9	function __unset($n)   {  echo "In " . __METHOD__ . "!\n"; }
10}
11$ao = new UsesMagic(array(), ArrayObject::ARRAY_AS_PROPS);
12
13echo "Doesn't trigger __get.\n";
14echo $ao->prop1;
15
16echo "Doesn't trigger __set.\n";
17$ao->prop2 = 'foo';
18
19echo "Doesn't trigger __unset.\n";
20unset($ao->prop3);
21
22echo "Shouldn't trigger __isset.\n";
23isset($ao->prop4);
24?>
25--EXPECTF--
26Doesn't trigger __get.
27
28Notice: Undefined index:  prop1 in %s on line 11
29Doesn't trigger __set.
30Doesn't trigger __unset.
31
32Notice: Undefined index:  prop3 in %s on line 17
33Shouldn't trigger __isset.