1--TEST--
2Test pow() function : usage variations - different data types as $base argument
3--INI--
4serialize_precision = 14
5--SKIPIF--
6<?php
7if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
8?>
9--FILE--
10<?php
11echo "*** Testing pow() : usage variations ***\n";
12
13//get an unset variable
14$unset_var = 10;
15unset ($unset_var);
16
17// heredoc string
18$heredoc = <<<EOT
19abc
20xyz
21EOT;
22
23// get a class
24class classA
25{
26}
27
28// get a resource variable
29$fp = fopen(__FILE__, "r");
30
31$inputs = array(
32       // int data
33/*1*/  0,
34       1,
35       12345,
36       -2345,
37       PHP_INT_MAX,
38
39       // float data
40/*6*/  10.5,
41       -10.5,
42       12.3456789000e10,
43       12.3456789000E-10,
44       .5,
45
46       // null data
47/*11*/ NULL,
48       null,
49
50       // boolean data
51/*13*/ true,
52       false,
53       TRUE,
54       FALSE,
55
56       // empty data
57/*17*/ "",
58       '',
59       array(),
60
61       // string data
62/*20*/ "abcxyz",
63       'abcxyz',
64       $heredoc,
65
66       // object data
67/*23*/ new classA(),
68
69       // undefined data
70/*24*/ @$undefined_var,
71
72       // unset data
73/*25*/ @$unset_var,
74
75       // resource variable
76/*26*/ $fp
77);
78
79// loop through each element of $inputs to check the behaviour of pow()
80$iterator = 1;
81foreach($inputs as $input) {
82    echo "\n-- Iteration $iterator --\n";
83    try {
84        var_dump(pow($input, 3));
85    } catch (Error $e) {
86        echo $e->getMessage(), "\n";
87    }
88    $iterator++;
89};
90fclose($fp);
91?>
92--EXPECTF--
93*** Testing pow() : usage variations ***
94
95-- Iteration 1 --
96int(0)
97
98-- Iteration 2 --
99int(1)
100
101-- Iteration 3 --
102float(1881365963625)
103
104-- Iteration 4 --
105float(-12895213625)
106
107-- Iteration 5 --
108float(9.903520300448E+27)
109
110-- Iteration 6 --
111float(1157.625)
112
113-- Iteration 7 --
114float(-1157.625)
115
116-- Iteration 8 --
117float(1.881676371789%dE+33)
118
119-- Iteration 9 --
120float(1.881676371789%dE-27)
121
122-- Iteration 10 --
123float(0.125)
124
125-- Iteration 11 --
126int(0)
127
128-- Iteration 12 --
129int(0)
130
131-- Iteration 13 --
132int(1)
133
134-- Iteration 14 --
135int(0)
136
137-- Iteration 15 --
138int(1)
139
140-- Iteration 16 --
141int(0)
142
143-- Iteration 17 --
144Unsupported operand types: string ** int
145
146-- Iteration 18 --
147Unsupported operand types: string ** int
148
149-- Iteration 19 --
150Unsupported operand types: array ** int
151
152-- Iteration 20 --
153Unsupported operand types: string ** int
154
155-- Iteration 21 --
156Unsupported operand types: string ** int
157
158-- Iteration 22 --
159Unsupported operand types: string ** int
160
161-- Iteration 23 --
162Unsupported operand types: classA ** int
163
164-- Iteration 24 --
165int(0)
166
167-- Iteration 25 --
168int(0)
169
170-- Iteration 26 --
171Unsupported operand types: resource ** int
172