xref: /PHP-7.3/ext/standard/tests/array/bug24766.phpt (revision c55c7ef0)
1--TEST--
2Bug #24766 (strange result array from unpack)
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8$a = unpack('C2', "\0224V");
9$b = array(1 => 18, 2 => 52);
10debug_zval_dump($a, $b);
11$k = array_keys($a);
12$l = array_keys($b);
13debug_zval_dump($k, $l);
14$i=$k[0];
15var_dump($a[$i]);
16$i=$l[0];
17var_dump($b[$i]);
18?>
19--EXPECTF--
20array(2) refcount(%d){
21  [1]=>
22  int(18)
23  [2]=>
24  int(52)
25}
26array(2) refcount(%d){
27  [1]=>
28  int(18)
29  [2]=>
30  int(52)
31}
32array(2) refcount(%d){
33  [0]=>
34  int(1)
35  [1]=>
36  int(2)
37}
38array(2) refcount(%d){
39  [0]=>
40  int(1)
41  [1]=>
42  int(2)
43}
44int(18)
45int(18)
46