1--TEST--
2Test array_fill_keys() function : variation of parameter
3--FILE--
4<?php
5/* Testing with unexpected argument types */
6
7echo "*** Testing array_fill_keys() : parameter variations ***\n";
8
9$fp = fopen(__FILE__, "r");
10$bool = false;
11$float = 2.4;
12$array = array("one");
13$nullVal = null;
14$unset_var = 10;
15unset ($unset_var);
16
17
18class classA {
19  public function __toString() { return "Class A object"; }
20}
21$obj = new classA();
22
23echo "\n-- Testing array_fill_keys() function with float --\n";
24var_dump( array_fill_keys($array, $float) );
25
26echo "\n-- Testing array_fill_keys() function with null --\n";
27var_dump( array_fill_keys($array, $nullVal) );
28
29echo "\n-- Testing array_fill_keys() function with object --\n";
30var_dump( array_fill_keys($array, $obj) );
31
32echo "\n-- Testing array_fill_keys() function with boolean --\n";
33var_dump( array_fill_keys($array, $bool) );
34
35echo "\n-- Testing array_fill_keys() function with resource --\n";
36var_dump( array_fill_keys($array, $fp) );
37
38echo "\n-- Testing array_fill_keys() function with unset var --\n";
39var_dump( array_fill_keys($array, $unset_var) );
40
41fclose($fp);
42echo "Done";
43?>
44--EXPECTF--
45*** Testing array_fill_keys() : parameter variations ***
46
47-- Testing array_fill_keys() function with float --
48array(1) {
49  ["one"]=>
50  float(2.4)
51}
52
53-- Testing array_fill_keys() function with null --
54array(1) {
55  ["one"]=>
56  NULL
57}
58
59-- Testing array_fill_keys() function with object --
60array(1) {
61  ["one"]=>
62  object(classA)#%d (0) {
63  }
64}
65
66-- Testing array_fill_keys() function with boolean --
67array(1) {
68  ["one"]=>
69  bool(false)
70}
71
72-- Testing array_fill_keys() function with resource --
73array(1) {
74  ["one"]=>
75  resource(%d) of type (stream)
76}
77
78-- Testing array_fill_keys() function with unset var --
79
80Warning: Undefined variable $unset_var in %s on line %d
81array(1) {
82  ["one"]=>
83  NULL
84}
85Done
86