1--TEST--
2Test posix_strerror() function : usage variations
3--SKIPIF--
4<?php
5	if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
6?>
7--FILE--
8<?php
9/* Prototype  : proto string posix_strerror(int errno)
10 * Description: Retrieve the system error message associated with the given errno.
11 * Source code: ext/posix/posix.c
12 * Alias to functions:
13 */
14
15echo "*** Testing posix_strerror() : usage variations ***\n";
16
17// Initialise function arguments not being substituted (if any)
18
19//get an unset variable
20$unset_var = 10;
21unset ($unset_var);
22
23//array of values to iterate over
24$values = array(
25
26      // float data
27      10.5,
28      -10.5,
29      10.1234567e10,
30      10.7654321E-10,
31      .5,
32
33      // array data
34      array(),
35      array(0),
36      array(1),
37      array(1, 2),
38      array('color' => 'red', 'item' => 'pen'),
39
40      // null data
41      NULL,
42      null,
43
44      // boolean data
45      true,
46      false,
47      TRUE,
48      FALSE,
49
50      // empty data
51      "",
52      '',
53
54      // string data
55      "string",
56      'string',
57
58      // undefined data
59      $undefined_var,
60
61      // unset data
62      $unset_var,
63
64      // object data
65      new stdclass(),
66);
67
68// loop through each element of the array for errno
69
70foreach($values as $value) {
71      echo "\nArg value $value \n";
72      echo gettype( posix_strerror($value) )."\n";
73};
74
75echo "Done";
76?>
77--EXPECTF--
78*** Testing posix_strerror() : usage variations ***
79
80Notice: Undefined variable: undefined_var in %s on line %d
81
82Notice: Undefined variable: unset_var in %s on line %d
83
84Arg value 10.5
85string
86
87Arg value -10.5
88string
89
90Arg value 101234567000
91string
92
93Arg value 1.07654321E-9
94string
95
96Arg value 0.5
97string
98
99Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
100
101Arg value Array
102
103Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
104boolean
105
106Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
107
108Arg value Array
109
110Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
111boolean
112
113Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
114
115Arg value Array
116
117Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
118boolean
119
120Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
121
122Arg value Array
123
124Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
125boolean
126
127Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
128
129Arg value Array
130
131Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
132boolean
133
134Arg value
135string
136
137Arg value
138string
139
140Arg value 1
141string
142
143Arg value
144string
145
146Arg value 1
147string
148
149Arg value
150string
151
152Arg value
153
154Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
155boolean
156
157Arg value
158
159Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
160boolean
161
162Arg value string
163
164Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
165boolean
166
167Arg value string
168
169Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
170boolean
171
172Arg value
173string
174
175Arg value
176string
177
178Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
179