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
100Arg value Array
101
102Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
103bool(false)
104
105Arg value Array
106
107Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
108bool(false)
109
110Arg value Array
111
112Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
113bool(false)
114
115Arg value Array
116
117Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
118bool(false)
119
120Arg value Array
121
122Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
123bool(false)
124
125Arg value
126bool(false)
127
128Arg value
129bool(false)
130
131Arg value 1
132bool(false)
133
134Arg value
135bool(false)
136
137Arg value 1
138bool(false)
139
140Arg value
141bool(false)
142
143Arg value
144
145Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
146bool(false)
147
148Arg value
149
150Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
151bool(false)
152
153Arg value string
154
155Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
156bool(false)
157
158Arg value string
159
160Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
161bool(false)
162
163Arg value
164bool(false)
165
166Arg value
167bool(false)
168
169Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
170