1--TEST--
2Test octdec() function : usage variations - different data types as $octal_string arg
3--INI--
4precision=14
5--FILE--
6<?php
7echo "*** Testing octdec() : usage variations ***\n";
8
9// heredoc string
10$heredoc = <<<EOT
11abc
12xyz
13EOT;
14
15// get a resource variable
16$fp = fopen(__FILE__, "r");
17
18$inputs = array(
19       // int data
20/*1*/  0,
21       1,
22       12345,
23       -2345,
24       4294967295,  // largest decimal
25       4294967296,
26
27       // float data
28/*7*/  10.5,
29       -10.5,
30       12.3456789000e10,
31       12.3456789000E-10,
32       .5,
33
34       // boolean data
35/*14*/ true,
36       false,
37       TRUE,
38       FALSE,
39
40       // empty data
41/*18*/ "",
42       '',
43       array(),
44
45       // string data
46/*21*/ "abcxyz",
47       'abcxyz',
48       $heredoc,
49
50       // resource variable
51/*26*/ $fp
52);
53
54// loop through each element of $inputs to check the behaviour of octdec()
55$iterator = 1;
56foreach($inputs as $input) {
57    echo "\n-- Iteration $iterator --\n";
58    try {
59        var_dump(octdec($input));
60    } catch (TypeError $e) {
61        echo $e->getMessage(), "\n";
62    }
63    $iterator++;
64};
65fclose($fp);
66?>
67---Done---
68--EXPECTF--
69*** Testing octdec() : usage variations ***
70
71-- Iteration 1 --
72int(0)
73
74-- Iteration 2 --
75int(1)
76
77-- Iteration 3 --
78int(5349)
79
80-- Iteration 4 --
81
82Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
83int(1253)
84
85-- Iteration 5 --
86
87Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
88int(1134037)
89
90-- Iteration 6 --
91
92Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
93int(1134038)
94
95-- Iteration 7 --
96
97Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
98int(69)
99
100-- Iteration 8 --
101
102Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
103int(69)
104
105-- Iteration 9 --
106
107Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
108int(175304192)
109
110-- Iteration 10 --
111
112Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
113int(342391)
114
115-- Iteration 11 --
116
117Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
118int(5)
119
120-- Iteration 12 --
121int(1)
122
123-- Iteration 13 --
124int(0)
125
126-- Iteration 14 --
127int(1)
128
129-- Iteration 15 --
130int(0)
131
132-- Iteration 16 --
133int(0)
134
135-- Iteration 17 --
136int(0)
137
138-- Iteration 18 --
139octdec(): Argument #1 ($octal_string) must be of type string, array given
140
141-- Iteration 19 --
142
143Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
144int(0)
145
146-- Iteration 20 --
147
148Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
149int(0)
150
151-- Iteration 21 --
152
153Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
154int(0)
155
156-- Iteration 22 --
157octdec(): Argument #1 ($octal_string) must be of type string, resource given
158---Done---
159