Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-12655: proc_open() does not take into account references in th…
…e descriptor array Closes GH-12658.
- Loading branch information
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
GH-12655 (proc_open(): Argument #2 ($descriptor_spec) must only contain arrays and streams [Descriptor item must be either an array or a File-Handle]) | ||
--FILE-- | ||
<?php | ||
|
||
$descriptor_spec = [ | ||
0 => [ "pipe", "r" ], // stdin is a pipe that the child will read from | ||
1 => [ "pipe", "w" ], // stdout is a pipe that the child will write to | ||
2 => [ "pipe", "w" ], // stderr is a file to write to | ||
]; | ||
|
||
foreach ( $descriptor_spec as $fd => &$d ) | ||
{ | ||
// don't do anything, just the fact that we used "&$d" will sink the ship! | ||
} | ||
|
||
$proc = proc_open(PHP_BINARY, $descriptor_spec, $pipes); | ||
echo $proc === false ? "FAILED\n" : "SUCCEEDED\n"; | ||
|
||
?> | ||
--EXPECT-- | ||
SUCCEEDED |