1--TEST--
2pcntl_waitpid() and rusage
3--EXTENSIONS--
4pcntl
5posix
6--FILE--
7<?php
8$pid = pcntl_fork();
9if ($pid == -1) {
10    die("failed");
11} else if ($pid) {
12    $status = 0;
13    var_dump(pcntl_waitpid($pid, $status, WUNTRACED, $rusage));
14    var_dump($rusage['ru_utime.tv_sec']);
15    var_dump($rusage['ru_utime.tv_usec']);
16
17    posix_kill($pid, SIGCONT);
18
19    $rusage = array(1,2,3);
20    pcntl_waitpid($pid, $status, WUNTRACED, $rusage);
21    var_dump($rusage['ru_utime.tv_sec']);
22    var_dump($rusage['ru_utime.tv_usec']);
23
24    $rusage = "string";
25    pcntl_waitpid($pid, $status, 0, $rusage);
26    var_dump(gettype($rusage));
27    var_dump(count($rusage));
28
29    $rusage = new stdClass;
30    pcntl_waitpid($pid, $status, 0, $rusage);
31    var_dump(gettype($rusage));
32    var_dump(count($rusage));
33
34    echo "END\n";
35} else {
36    posix_kill(posix_getpid(), SIGSTOP);
37    exit(42);
38}
39?>
40--EXPECTF--
41int(%d)
42int(%d)
43int(%d)
44int(%d)
45int(%d)
46string(5) "array"
47int(0)
48string(5) "array"
49int(0)
50END
51