summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/bug31158.phpt
blob: 02d74875d310a7210106e8dbf8044666560a3d4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
Bug #31158 (array_splice on $GLOBALS crashes)
--INI--
error_reporting = E_ALL
--FILE--
<?php
function __(){
  $GLOBALS['a'] = "bug\n";
  array_splice($GLOBALS,0,count($GLOBALS));
  /* All global variables including $GLOBALS are removed */
  echo $GLOBALS['a'];
}
__();
echo "ok\n";
?>
--EXPECTF--
Warning: Undefined variable $GLOBALS in %s on line %d

Warning: Trying to access array offset on value of type null in %s on line %d
ok