xref: /PHP-8.4/ext/spl/tests/bug79393.phpt (revision 47c74555)
1--TEST--
2Bug #79393 (Null coalescing operator failing with SplFixedArray)
3--FILE--
4<?php
5$foo = new SplFixedArray(5);
6$foo[0] = 'bar1';
7$foo[1] = 'bar2';
8$foo[2] = 0;
9$foo[3] = false;
10$foo[4] = '';
11
12var_dump($foo[0] ?? null);
13var_dump($foo[1] ?? null);
14var_dump($foo[2] ?? null);
15var_dump($foo[3] ?? null);
16var_dump($foo[4] ?? null);
17var_dump($foo[5] ?? null);
18?>
19--EXPECT--
20string(4) "bar1"
21string(4) "bar2"
22int(0)
23bool(false)
24string(0) ""
25NULL
26