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(1, 2, 3); 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(0 => array('pipe', 'r'), 1 => array('pipe', 'w')), 11: $pipes, getcwd(), 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_fds, 5); 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 Fri, 17 May 2013 23:23:52 +0000 (2 days ago)
|