xref: /PHP-7.4/ext/standard/tests/array/bug31158.phpt (revision c42b7dd6)
1--TEST--
2Bug #31158 (array_splice on $GLOBALS crashes)
3--INI--
4error_reporting = E_ALL
5--FILE--
6<?php
7function __(){
8  $GLOBALS['a'] = "bug\n";
9  array_splice($GLOBALS,0,count($GLOBALS));
10  /* All global variables including $GLOBALS are removed */
11  echo $GLOBALS['a'];
12}
13__();
14echo "ok\n";
15?>
16--EXPECTF--
17Notice: Undefined variable: GLOBALS in %sbug31158.php on line 6
18
19Notice: Trying to access array offset on value of type null in %sbug31158.php on line 6
20ok
21