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