xref: /PHP-7.4/ext/standard/tests/array/bug22088.phpt (revision 073a80fb)
1--TEST--
2Bug #22088 (array_shift() leaves next index to be +1 too much)
3--FILE--
4<?php
5
6$a = array('a', 'b', 'c');
7$last = array_shift ($a);
8$a[] = 'a';
9var_dump($a);
10
11$a = array('a' => 1, 'b' => 2, 'c' => 3);
12$last = array_shift ($a);
13$a[] = 'a';
14var_dump($a);
15
16?>
17--EXPECT--
18array(3) {
19  [0]=>
20  string(1) "b"
21  [1]=>
22  string(1) "c"
23  [2]=>
24  string(1) "a"
25}
26array(3) {
27  ["b"]=>
28  int(2)
29  ["c"]=>
30  int(3)
31  [0]=>
32  string(1) "a"
33}
34