1--TEST--
2Test posix_kill() function : usage variations  - second parameter type
3--SKIPIF--
4<?php
5	if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
6?>
7--FILE--
8<?php
9/* Prototype  : proto bool posix_kill(int pid, int sig)
10 * Description: Send a signal to a process (POSIX.1, 3.3.2)
11 * Source code: ext/posix/posix.c
12 * Alias to functions:
13 */
14
15echo "*** Testing posix_kill() : usage variations ***\n";
16
17// Initialise function arguments not being substituted (if any)
18$pid = -999;
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 sig
70
71foreach($values as $value) {
72      echo "\nArg value $value \n";
73      var_dump( posix_kill($pid, $value) );
74};
75
76echo "Done";
77?>
78--EXPECTF--
79*** Testing posix_kill() : 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
86bool(false)
87
88Arg value -10.5
89bool(false)
90
91Arg value 101234567000
92bool(false)
93
94Arg value 1.07654321E-9
95bool(false)
96
97Arg value 0.5
98bool(false)
99
100Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
101
102Arg value Array
103
104Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
105bool(false)
106
107Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
108
109Arg value Array
110
111Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
112bool(false)
113
114Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
115
116Arg value Array
117
118Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
119bool(false)
120
121Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
122
123Arg value Array
124
125Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
126bool(false)
127
128Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
129
130Arg value Array
131
132Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
133bool(false)
134
135Arg value
136bool(false)
137
138Arg value
139bool(false)
140
141Arg value 1
142bool(false)
143
144Arg value
145bool(false)
146
147Arg value 1
148bool(false)
149
150Arg value
151bool(false)
152
153Arg value
154
155Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
156bool(false)
157
158Arg value
159
160Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
161bool(false)
162
163Arg value string
164
165Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
166bool(false)
167
168Arg value string
169
170Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
171bool(false)
172
173Arg value
174bool(false)
175
176Arg value
177bool(false)
178
179Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
180