File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
ext/standard/tests/streams Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #78883 (fgets(STDIN) fails on Windows)
3
+ --SKIPIF--
4
+ <?php
5
+ if (PHP_OS_FAMILY !== 'Windows ' ) die ('skip this test is for Windows platforms only ' );
6
+ if (getenv ("SKIP_SLOW_TESTS " )) die ("skip slow test " );
7
+ ?>
8
+ --FILE--
9
+ <?php
10
+ $ descriptorspec = array (
11
+ 0 => array ("pipe " , "rb " ),
12
+ 1 => array ("pipe " , "wb " ),
13
+ //2 => array("file", "stderr.txt", "ab")
14
+ );
15
+ $ pipes = [];
16
+ $ cmd = proc_open ('cmd.exe "/c START ^"^" /WAIT php -r ^"var_dump(fgets(STDIN));" ' , $ descriptorspec , $ pipes );
17
+ var_dump (is_resource ($ cmd ));
18
+ $ cmdpid = proc_get_status ($ cmd )['pid ' ];
19
+ sleep (1 );
20
+ $ bug_is_present = !proc_get_status ($ cmd )['running ' ];
21
+ if (!$ bug_is_present ) {
22
+ // if the bug is not present, it will hang waiting for stdin,
23
+ // thus cmd is still running and we should kill it
24
+ shell_exec ("taskkill /T /F /PID {$ cmdpid }" );
25
+ }
26
+ fclose ($ pipes [0 ]);
27
+ fclose ($ pipes [1 ]);
28
+ proc_close ($ cmd );
29
+ var_dump ($ bug_is_present );
30
+ ?>
31
+ --EXPECT--
32
+ bool(true)
33
+ bool(false)
You can’t perform that action at this time.
0 commit comments