1--TEST--
2Test array_uintersect_uassoc() function : usage variation
3--FILE--
4<?php
5echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
6
7// Initialise function arguments not being substituted (if any)
8$array2 = array(1, 2);
9
10include('compare_function.inc');
11$data_compare_func = 'compare_function';
12$key_compare_func = 'compare_function';
13
14//get an unset variable
15$unset_var = 10;
16unset ($unset_var);
17
18// define some classes
19class classWithToString
20{
21    public function __toString() {
22        return "Class A object";
23    }
24}
25
26class classWithoutToString
27{
28}
29
30// heredoc string
31$heredoc = <<<EOT
32hello world
33EOT;
34
35// add arrays
36$index_array = array (1, 2, 3);
37$assoc_array = array ('one' => 1, 'two' => 2);
38
39//array of values to iterate over
40$inputs = array(
41
42      // int data
43      'int 0' => 0,
44      'int 1' => 1,
45      'int 12345' => 12345,
46      'int -12345' => -2345,
47
48      // float data
49      'float 10.5' => 10.5,
50      'float -10.5' => -10.5,
51      'float 12.3456789000e10' => 12.3456789000e10,
52      'float -12.3456789000e10' => -12.3456789000e10,
53      'float .5' => .5,
54
55      // null data
56      'uppercase NULL' => NULL,
57      'lowercase null' => null,
58
59      // boolean data
60      'lowercase true' => true,
61      'lowercase false' =>false,
62      'uppercase TRUE' =>TRUE,
63      'uppercase FALSE' =>FALSE,
64
65      // empty data
66      'empty string DQ' => "",
67      'empty string SQ' => '',
68
69      // string data
70      'string DQ' => "string",
71      'string SQ' => 'string',
72      'mixed case string' => "sTrInG",
73      'heredoc' => $heredoc,
74
75      // object data
76      'instance of classWithToString' => new classWithToString(),
77      'instance of classWithoutToString' => new classWithoutToString(),
78
79      // undefined data
80      'undefined var' => @$undefined_var,
81
82      // unset data
83      'unset var' => @$unset_var,
84);
85
86// loop through each element of the array for array1
87
88foreach($inputs as $key =>$value) {
89    echo "\n--$key--\n";
90    try {
91        var_dump( array_uintersect_uassoc($value, $array2, $data_compare_func, $key_compare_func) );
92    } catch (TypeError $e) {
93        echo $e->getMessage(), "\n";
94    }
95};
96
97?>
98--EXPECT--
99*** Testing array_uintersect_uassoc() : usage variation ***
100
101--int 0--
102array_uintersect_uassoc(): Argument #1 ($array) must be of type array, int given
103
104--int 1--
105array_uintersect_uassoc(): Argument #1 ($array) must be of type array, int given
106
107--int 12345--
108array_uintersect_uassoc(): Argument #1 ($array) must be of type array, int given
109
110--int -12345--
111array_uintersect_uassoc(): Argument #1 ($array) must be of type array, int given
112
113--float 10.5--
114array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given
115
116--float -10.5--
117array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given
118
119--float 12.3456789000e10--
120array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given
121
122--float -12.3456789000e10--
123array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given
124
125--float .5--
126array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given
127
128--uppercase NULL--
129array_uintersect_uassoc(): Argument #1 ($array) must be of type array, null given
130
131--lowercase null--
132array_uintersect_uassoc(): Argument #1 ($array) must be of type array, null given
133
134--lowercase true--
135array_uintersect_uassoc(): Argument #1 ($array) must be of type array, true given
136
137--lowercase false--
138array_uintersect_uassoc(): Argument #1 ($array) must be of type array, false given
139
140--uppercase TRUE--
141array_uintersect_uassoc(): Argument #1 ($array) must be of type array, true given
142
143--uppercase FALSE--
144array_uintersect_uassoc(): Argument #1 ($array) must be of type array, false given
145
146--empty string DQ--
147array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given
148
149--empty string SQ--
150array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given
151
152--string DQ--
153array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given
154
155--string SQ--
156array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given
157
158--mixed case string--
159array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given
160
161--heredoc--
162array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given
163
164--instance of classWithToString--
165array_uintersect_uassoc(): Argument #1 ($array) must be of type array, classWithToString given
166
167--instance of classWithoutToString--
168array_uintersect_uassoc(): Argument #1 ($array) must be of type array, classWithoutToString given
169
170--undefined var--
171array_uintersect_uassoc(): Argument #1 ($array) must be of type array, null given
172
173--unset var--
174array_uintersect_uassoc(): Argument #1 ($array) must be of type array, null given
175