xref: /PHP-8.2/ext/spl/tests/bug45622b.phpt (revision 71fb8356)
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
28Warning: Undefined array key "prop1" in %s on line %d
29Doesn't trigger __set.
30Doesn't trigger __unset.
31Shouldn't trigger __isset.
32