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