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 (3) { 39 ["name"]=> 40 string(%d) "{closure:%s:%d}" 41 ["file"]=> 42 string(%d) "%s" 43 ["line"]=> 44 int(%d) 45 } 46} 47int(2) 48array(1) { 49 [0]=> 50 object(Closure)#%d (4) { 51 ["name"]=> 52 string(%d) "{closure:%s:%d}" 53 ["file"]=> 54 string(%d) "%s" 55 ["line"]=> 56 int(%d) 57 ["static"]=> 58 array(1) { 59 ["h"]=> 60 &array(1) { 61 [0]=> 62 object(Closure)#%d (3) { 63 ["name"]=> 64 string(%d) "{closure:%s:%d}" 65 ["file"]=> 66 string(%d) "%s" 67 ["line"]=> 68 int(%d) 69 } 70 } 71 } 72 } 73} 74object(Closure)#%d (4) { 75 ["name"]=> 76 string(%d) "{closure:%s:%d}" 77 ["file"]=> 78 string(%d) "%s" 79 ["line"]=> 80 int(%d) 81 ["static"]=> 82 array(1) { 83 ["h"]=> 84 &array(1) { 85 [0]=> 86 object(Closure)#%d (3) { 87 ["name"]=> 88 string(%d) "{closure:%s:%d}" 89 ["file"]=> 90 string(%d) "%s" 91 ["line"]=> 92 int(%d) 93 } 94 } 95 } 96} 97array(1) { 98 [0]=> 99 object(Closure)#%d (3) { 100 ["name"]=> 101 string(%d) "{closure:%s:%d}" 102 ["file"]=> 103 string(%d) "%s" 104 ["line"]=> 105 int(%d) 106 } 107} 108array(2) { 109 [0]=> 110 object(Closure)#%d (3) { 111 ["name"]=> 112 string(%d) "{closure:%s:%d}" 113 ["file"]=> 114 string(%d) "%s" 115 ["line"]=> 116 int(%d) 117 } 118 [1]=> 119 int(5) 120} 121