php-src/ext/spl/tests/SplFixedArray_indirect_modification.phpt
Nikita Popov ca8657a2b5 Initialize SplFixedArray elements to NULL instead of UNDEF
The SplFixedArray API treats all elements as NULL, even if they
have not been explicitly initialized. Rather than initializing
to UNDEF an treating that specially in various circumstances,
directly initialize elements to NULL.

This also fixes an assertion failure in the attached test case.
2020-01-30 15:31:39 +01:00

14 lines
283 B
PHP

--TEST--
SplFixedArray indirect modification notice
--FILE--
<?php
$a = new SplFixedArray(1);
$a[0][] = 3;
var_dump($a);
?>
--EXPECTF--
Notice: Indirect modification of overloaded element of SplFixedArray has no effect in %s on line %d
object(SplFixedArray)#1 (1) {
[0]=>
NULL
}