File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace Bug13197 ;
4
+
5
+ use function PHPStan \Testing \assertType ;
6
+
7
+ /**
8
+ * @return array{string, string}|null STDOUT & STDERR tuple
9
+ */
10
+ function execute (string $ command ): ?array
11
+ {
12
+ if (!function_exists ('proc_open ' )) {
13
+ return null ;
14
+ }
15
+
16
+ $ pipes = [];
17
+
18
+ $ process = @proc_open (
19
+ $ command ,
20
+ [
21
+ ['pipe ' , 'rb ' ],
22
+ ['pipe ' , 'wb ' ], // stdout
23
+ ['pipe ' , 'wb ' ], // stderr
24
+ ],
25
+ $ pipes
26
+ );
27
+
28
+ assertType ('list<resource> ' , $ pipes );
29
+
30
+ if (!is_resource ($ process )) {
31
+ return null ;
32
+ }
33
+
34
+ fclose ($ pipes [0 ]);
35
+
36
+ $ stdout = (string ) stream_get_contents ($ pipes [1 ]);
37
+ $ stderr = (string ) stream_get_contents ($ pipes [2 ]);
38
+
39
+ proc_close ($ process );
40
+
41
+ return [$ stdout , $ stderr ];
42
+ }
Original file line number Diff line number Diff line change @@ -2216,4 +2216,11 @@ public function testBug12317(): void
2216
2216
]);
2217
2217
}
2218
2218
2219
+ public function testBug13197 (): void
2220
+ {
2221
+ $ this ->checkExplicitMixed = true ;
2222
+ $ this ->checkImplicitMixed = true ;
2223
+ $ this ->analyse ([__DIR__ . '/../../Analyser/nsrt/bug-13197.php ' ], []);
2224
+ }
2225
+
2219
2226
}
You can’t perform that action at this time.
0 commit comments