PHP  
 PHP_5_6
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/standard/tests/file/proc_open01.phpt ('proc_open() regression test 1 (proc_open() leak)')

Script

1: <?php
2: $pipes 
= array(123);
3:
$orig_pipes $pipes;
4:
$php getenv('TEST_PHP_EXECUTABLE'); 
5: if (
$php === false) {
6:     die(
"no php executable defined");
7:
8:
$proc proc_open(
9:     
"$php -n",
10:     array(
=> array('pipe''r'), => array('pipe''w')),
11:     
$pipesgetcwd(), array(), array('binary_pipes' => true)
12: );
13: if (
$proc === false) {
14:     print 
"something went wrong.\n";
15: }
16:
var_dump($pipes);
17:
stream_set_blocking($pipes[1], FALSE);
18:
$test_string b"yay!\n";
19:
fwrite($pipes[0], $test_string);
20:
fflush($pipes[0]);
21:
fclose($pipes[0]);
22:
$cnt '';
23:
$n=0;
24: for (
$left strlen($test_string); $left 0;) { 
25:     if (++
$n >1000) {
26:       print 
"terminated after 1000 iterations\n";
27:       break;
28:     }
29:     
$read_fds = array($pipes[1]);
30:     
$write_fds NULL;
31:     
$exp_fds NULL;
32:     
$retval stream_select($read_fds$write_fds$exp_fds5);
33:     if (
$retval === false) {
34:         print 
"select() failed\n";
35:         break;
36:     }
37:     if (
$retval === 0) {
38:         print 
"timed out\n";
39:         break;
40:     }
41:     
$buf fread($pipes[1], 1024);
42:     
$cnt .= $buf;
43:     
$left -= strlen($buf);
44: }
45:
var_dump($cnt);
46:
fclose($pipes[1]);
47:
proc_close($proc);
48:
var_dump($orig_pipes);
49:
?>
50:

Expected

array(2) {
  [0]=>
  resource(%d) of type (stream)
  [1]=>
  resource(%d) of type (stream)
}
%unicode|string%(5) "yay!
"
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}

Output

array(2) {
  [0]=>
  resource(4) of type (stream)
  [1]=>
  resource(5) of type (stream)
}
timed out
string(0) ""
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}

Diff

007+ timed out
008+ string(0) ""
007- %unicode|string%(5) "yay!
008- "

 

Generated at Tue, 28 Oct 2014 09:43:43 +0000 (3 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.