xref: /PHP-7.2/ext/spl/tests/bug61347.phpt (revision f1d7e3ca)
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--EXPECT--
26bool(false)
27bool(false)
28bool(false)
29bool(false)
30bool(true)
31bool(true)
32bool(true)
33NULL
34bool(true)
35bool(true)
36bool(false)
37bool(true)
38bool(true)
39