1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00
Files
archived-php-src/ext/spl/tests/bug79393.phpt
Christoph M. Becker 47c745555c Fix #79393: Null coalescing operator failing with SplFixedArray
We favor the KISS principle over optimization[1] – SPL is already
special enough.

[1] <352f3d4476 (r112498098)>ff
2020-03-23 13:29:25 +01:00

26 lines
446 B
PHP

--TEST--
Bug #79393 (Null coalescing operator failing with SplFixedArray)
--FILE--
<?php
$foo = new SplFixedArray(5);
$foo[0] = 'bar1';
$foo[1] = 'bar2';
$foo[2] = 0;
$foo[3] = false;
$foo[4] = '';
var_dump($foo[0] ?? null);
var_dump($foo[1] ?? null);
var_dump($foo[2] ?? null);
var_dump($foo[3] ?? null);
var_dump($foo[4] ?? null);
var_dump($foo[5] ?? null);
?>
--EXPECT--
string(4) "bar1"
string(4) "bar2"
int(0)
bool(false)
string(0) ""
NULL