-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.2: Fix GH-11498: SIGCHLD is not always returned from proc_open
- Loading branch information
Showing
2 changed files
with
84 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--TEST-- | ||
GH-11498 (SIGCHLD is not always returned from proc_open) | ||
--EXTENSIONS-- | ||
pcntl | ||
--SKIPIF-- | ||
<?php | ||
if (PHP_OS != 'Linux') { | ||
die('skip Linux only'); | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
$processes = []; | ||
|
||
pcntl_async_signals(true); | ||
pcntl_signal(SIGCHLD, function($sig, $info) use (&$processes) { | ||
unset($processes[$info['pid']]); | ||
}, false); | ||
|
||
foreach (range(0, 5) as $i) { | ||
$process = proc_open('echo $$ > /dev/null', [], $pipes); | ||
$pid = proc_get_status($process)['pid']; | ||
$processes[$pid] = $process; | ||
} | ||
|
||
$iters = 50; | ||
while (!empty($processes) && $iters > 0) { | ||
usleep(100_000); | ||
$iters--; | ||
} | ||
|
||
var_dump(empty($processes)); | ||
?> | ||
--EXPECT-- | ||
bool(true) |