php-src/Zend/tests/const_dereference_001.phpt
Nikita Popov c48b745f00 Promote "undefined array key" notice to warning
This implements the last remaining part of the
https://wiki.php.net/rfc/engine_warnings RFC.

Closes GH-5927.
2020-08-03 14:40:50 +02:00

22 lines
351 B
PHP

--TEST--
Const array deference
--FILE--
<?php
error_reporting(E_ALL);
var_dump(array(1, 2, 3, 4,) [3]);
var_dump(array(1, 2, 3, 4,) ['foo']);
var_dump(array(array(1,2,3), array(4, 5, 6))[1][2]);
foreach (array(array(1, 2, 3))[0] as $var) {
echo $var;
}
?>
--EXPECTF--
int(4)
Warning: Undefined array key "foo" in %s on line %d
NULL
int(6)
123