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