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

Test Failure Report for ext/standard/tests/streams/proc_open_bug69900.phpt ('Bug #69900 Commandline input/output weird behaviour with STDIO')

Script

1: <?php
2:
3: error_reporting
(E_ALL);
4:
5:
$fl dirname(__FILE__) . DIRECTORY_SEPARATOR "test69900.php";
6:
$max_ms = ((bool)getenv('TRAVIS')) ? 10 1;
7:
8:
$test_content '<?php
9:
10: $in = fopen("php://stdin", "rb", false, stream_context_create(array("pipe" => array("blocking" => true))));
11:
12: while(!feof($in)){
13: $s = fgets($in);
14:     fwrite(STDOUT, $s);
15: }
16:
17: ?>'
;
18:
file_put_contents($fl$test_content);
19:
20:
$descriptorspec = array(=> array("pipe""r"),=> array("pipe""w"));
21:
$pipes = array();
22:
23:
$process proc_open(PHP_BINARY.' -n -f ' $fl$descriptorspec$pipesNULLNULL, array("blocking_pipes" => true));
24:
25: for(
$i 0$i 10$i++){
26:     
fwrite($pipes[0], "hello$i\r\n");
27:     
fflush($pipes[0]);
28:
29:     
$t0 microtime(1);
30:     
$s fgets($pipes[1]);
31:     
$t1 microtime(1);
32:
33:     echo 
$s;        
34:     echo 
"fgets() took ", (($t1 $t0)*1000 $max_ms 'more' 'less'), " than $max_ms ms\n";
35: }
36:
37:
fclose($pipes[0]);
38:
fclose($pipes[1]);
39:
40:
proc_close($process);
41:
42:
?>
43:
===DONE===
44:

Expected

hello0
fgets() took more than %d ms
hello1
fgets() took less than %d ms
hello2
fgets() took less than %d ms
hello3
fgets() took less than %d ms
hello4
fgets() took less than %d ms
hello5
fgets() took less than %d ms
hello6
fgets() took less than %d ms
hello7
fgets() took less than %d ms
hello8
fgets() took less than %d ms
hello9
fgets() took less than %d ms
===DONE===

Output

hello0
fgets() took more than 1 ms
hello1
fgets() took more than 1 ms
hello2
fgets() took less than 1 ms
hello3
fgets() took less than 1 ms
hello4
fgets() took less than 1 ms
hello5
fgets() took less than 1 ms
hello6
fgets() took less than 1 ms
hello7
fgets() took less than 1 ms
hello8
fgets() took less than 1 ms
hello9
fgets() took less than 1 ms
===DONE===

Diff

004+ fgets() took more than 1 ms
004- fgets() took less than %d ms

 

Generated at Sat, 09 Sep 2017 03:10:54 +0000 (12 days ago)

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