Test Failure Report for ext/standard/tests/streams/proc_open_bug60120.phpt ('Bug #60120 proc_open hangs with stdin/out with 2048+ bytes')
Script
1:
<?php 2: error_reporting(E_ALL); 3: 4: if (substr(PHP_OS, 0, 3) == 'WIN') { 5: $cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"'; 6: } else { 7: $cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\''; 8: } 9: $descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')); 10: $stdin = str_repeat('*', 1024 * 16) . '!'; 11: $stdin = str_repeat('*', 2049 ); 12: 13: $options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false)); 14: $process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options); 15: 16: foreach ($pipes as $pipe) { 17: stream_set_blocking($pipe, false); 18: } 19: $writePipes = array($pipes[0]); 20: $stdinLen = strlen($stdin); 21: $stdinOffset = 0; 22: 23: unset($pipes[0]); 24: 25: while ($pipes || $writePipes) { 26: $r = $pipes; 27: $w = $writePipes; 28: $e = null; 29: $n = stream_select($r, $w, $e, 60); 30: 31: if (false === $n) { 32: break; 33: } elseif ($n === 0) { 34: proc_terminate($process); 35: 36: } 37: if ($w) { 38: $written = fwrite($writePipes[0], substr($stdin, $stdinOffset), 8192); 39: if (false !== $written) { 40: $stdinOffset += $written; 41: } 42: if ($stdinOffset >= $stdinLen) { 43: fclose($writePipes[0]); 44: $writePipes = null; 45: } 46: } 47: 48: foreach ($r as $pipe) { 49: $type = array_search($pipe, $pipes); 50: $data = fread($pipe, 8192); 51: var_dump($data); 52: if (false === $data || feof($pipe)) { 53: fclose($pipe); 54: unset($pipes[$type]); 55: } 56: } 57: } 58: 59: 60: ?> 61: ===DONE=== 62:
Expected
string(2049) "%s"
string(2049) "%s"
string(0) ""
string(0) ""
===DONE===
Output
string(49) "Unable to find environment variable: ORACLE_HOME
"
string(2049) "*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************"
string(2049) "*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************"
string(0) ""
string(0) ""
===DONE===
Diff
001+ string(49) "Unable to find environment variable: ORACLE_HOME
002+ "
Generated at Sat, 21 Apr 2018 13:46:58 +0000 (45 hours ago)
|