xref: /PHP-5.6/Zend/tests/bug52193.phpt (revision 72bc2a9a)
1--TEST--
2Bug #52193 (converting closure to array yields empty array)
3--FILE--
4<?php
5
6var_dump((array) 1);
7var_dump((array) NULL);
8var_dump((array) new stdclass);
9var_dump($h = (array) function () { return 2; });
10var_dump($h[0]());
11
12$i = function () use (&$h) {
13	return $h;
14};
15
16var_dump($x = (array)$i);
17var_dump($y = $x[0]);
18var_dump($y());
19
20$items = range(1, 5);
21$func = function(){ return 'just a test'; };
22
23array_splice($items, 0 , 4, $func);
24var_dump($items);
25
26?>
27--EXPECTF--
28array(1) {
29  [0]=>
30  int(1)
31}
32array(0) {
33}
34array(0) {
35}
36array(1) {
37  [0]=>
38  object(Closure)#%d (0) {
39  }
40}
41int(2)
42array(1) {
43  [0]=>
44  object(Closure)#%d (1) {
45    ["static"]=>
46    array(1) {
47      ["h"]=>
48      &array(1) {
49        [0]=>
50        object(Closure)#%d (0) {
51        }
52      }
53    }
54  }
55}
56object(Closure)#%d (1) {
57  ["static"]=>
58  array(1) {
59    ["h"]=>
60    &array(1) {
61      [0]=>
62      object(Closure)#%d (0) {
63      }
64    }
65  }
66}
67array(1) {
68  [0]=>
69  object(Closure)#%d (0) {
70  }
71}
72array(2) {
73  [0]=>
74  object(Closure)#%d (0) {
75  }
76  [1]=>
77  int(5)
78}
79