1--TEST--
2Test getimagesize() function : usage variations  - unexpected type for arg 2
3--FILE--
4<?php
5/* Prototype  : proto array getimagesize(string imagefile [, array info])
6 * Description: Get the size of an image as 4-element array
7 * Source code: ext/standard/image.c
8 * Alias to functions:
9 */
10
11function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
12	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
13}
14set_error_handler('test_error_handler');
15
16echo "*** Testing getimagesize() : usage variations ***\n";
17
18// Initialise function arguments not being substituted (if any)
19$imagefile = dirname(__FILE__)."/test1pix.jpg";
20
21//get an unset variable
22$unset_var = 10;
23unset ($unset_var);
24
25//array of values to iterate over
26$values = array(
27
28      // int data
29      "0" => 0,
30      "1" => 1,
31      "12345" => 12345,
32      "-2345" => -2345,
33
34      // float data
35      "10.5" => 10.5,
36      "-10.5" => -10.5,
37      "10.1234567e5" => 10.1234567e10,
38      "10.7654321e-5" => 10.7654321E-5,
39      .5,
40
41      // array data
42      "array()" => array(),
43      "array(0)" => array(0),
44      "array(1)" => array(1),
45      "array(1, 2)" => array(1, 2),
46      "array('color' => 'red', 'item' => 'pen')" => array('color' => 'red', 'item' => 'pen'),
47
48      // null data
49      "NULL" => NULL,
50      "null" => null,
51
52      // boolean data
53      "true" => true,
54      "false" => false,
55      "TRUE" => TRUE,
56      "FALSE" => FALSE,
57
58      // empty data
59      "\"\"" => "",
60      "''" => '',
61
62      // object data
63      "new stdclass()" => new stdclass(),
64
65      // undefined data
66      "undefined_var" => $undefined_var,
67
68      // unset data
69      "unset_var" => $unset_var,
70);
71
72// loop through each element of the array for info
73
74foreach($values as $key => $value) {
75      echo "\n-- Arg value $key --\n";
76      getimagesize($imagefile, $value);
77      var_dump(bin2hex($value["APP0"]));
78};
79
80?>
81===DONE===
82--EXPECTF--
83*** Testing getimagesize() : usage variations ***
84Error: 8 - Undefined variable: undefined_var, %s(%d)
85Error: 8 - Undefined variable: unset_var, %s(%d)
86
87-- Arg value 0 --
88string(28) "4a46494600010201006000600000"
89
90-- Arg value 1 --
91string(28) "4a46494600010201006000600000"
92
93-- Arg value 12345 --
94string(28) "4a46494600010201006000600000"
95
96-- Arg value -2345 --
97string(28) "4a46494600010201006000600000"
98
99-- Arg value 10.5 --
100string(28) "4a46494600010201006000600000"
101
102-- Arg value -10.5 --
103string(28) "4a46494600010201006000600000"
104
105-- Arg value 10.1234567e5 --
106string(28) "4a46494600010201006000600000"
107
108-- Arg value 10.7654321e-5 --
109string(28) "4a46494600010201006000600000"
110
111-- Arg value 12346 --
112string(28) "4a46494600010201006000600000"
113
114-- Arg value array() --
115string(28) "4a46494600010201006000600000"
116
117-- Arg value array(0) --
118string(28) "4a46494600010201006000600000"
119
120-- Arg value array(1) --
121string(28) "4a46494600010201006000600000"
122
123-- Arg value array(1, 2) --
124string(28) "4a46494600010201006000600000"
125
126-- Arg value array('color' => 'red', 'item' => 'pen') --
127string(28) "4a46494600010201006000600000"
128
129-- Arg value NULL --
130string(28) "4a46494600010201006000600000"
131
132-- Arg value null --
133string(28) "4a46494600010201006000600000"
134
135-- Arg value true --
136string(28) "4a46494600010201006000600000"
137
138-- Arg value false --
139string(28) "4a46494600010201006000600000"
140
141-- Arg value TRUE --
142string(28) "4a46494600010201006000600000"
143
144-- Arg value FALSE --
145string(28) "4a46494600010201006000600000"
146
147-- Arg value "" --
148string(28) "4a46494600010201006000600000"
149
150-- Arg value '' --
151string(28) "4a46494600010201006000600000"
152
153-- Arg value new stdclass() --
154string(28) "4a46494600010201006000600000"
155
156-- Arg value undefined_var --
157string(28) "4a46494600010201006000600000"
158
159-- Arg value unset_var --
160string(28) "4a46494600010201006000600000"
161===DONE===
162