xref: /PHP-8.0/ext/standard/tests/array/bug31158.phpt (revision 36935e42)
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--
17Warning: Undefined variable $GLOBALS in %s on line %d
18
19Warning: Trying to access array offset on value of type null in %s on line %d
20ok
21