xref: /PHP-5.5/ext/standard/tests/array/bug24766.phpt (revision 4859431f)
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--EXPECT--
20array(2) refcount(2){
21  [1]=>
22  long(18) refcount(1)
23  [2]=>
24  long(52) refcount(1)
25}
26array(2) refcount(2){
27  [1]=>
28  long(18) refcount(1)
29  [2]=>
30  long(52) refcount(1)
31}
32array(2) refcount(2){
33  [0]=>
34  long(1) refcount(1)
35  [1]=>
36  long(2) refcount(1)
37}
38array(2) refcount(2){
39  [0]=>
40  long(1) refcount(1)
41  [1]=>
42  long(2) refcount(1)
43}
44int(18)
45int(18)
46