xref: /PHP-7.4/ext/spl/tests/bug61347.phpt (revision 0ba7c3ea)
1--TEST--
2Bug #61347 (inconsist isset behavior of Arrayobject)
3--FILE--
4<?php
5$a = array('b' => NULL, 37 => NULL);
6var_dump(isset($a['b'])); //false
7
8$b = new ArrayObject($a);
9var_dump(isset($b['b'])); //false
10var_dump(isset($b[37])); //false
11var_dump(isset($b['no_exists'])); //false
12var_dump(empty($b['b'])); //true
13var_dump(empty($b[37])); //true
14
15var_dump(array_key_exists('b', $b)); //true
16var_dump($b['b']);
17
18$a = array('b' => '', 37 => false);
19$b = new ArrayObject($a);
20var_dump(isset($b['b'])); //true
21var_dump(isset($b[37])); //true
22var_dump(isset($b['no_exists'])); //false
23var_dump(empty($b['b'])); //true
24var_dump(empty($b[37])); //true
25--EXPECTF--
26bool(false)
27bool(false)
28bool(false)
29bool(false)
30bool(true)
31bool(true)
32
33Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
34bool(true)
35NULL
36bool(true)
37bool(true)
38bool(false)
39bool(true)
40bool(true)
41