8000 And for a moment I thought StreamSelectLoop was unaffected · reactphp/event-loop@db0bda0 · GitHub
[go: up one dir, main page]

Skip to content

Commit db0bda0

Browse files
committed
And for a moment I thought StreamSelectLoop was unaffected
1 parent 5cb705b commit db0bda0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/StreamSelectLoop.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ public function __construct()
3232
$this->pcntl = extension_loaded('pcntl');
3333
$this->signals = new SignalsHandler(
3434
function ($signal) {
35-
\pcntl_signal($signal, function ($signal) {
35+
\pcntl_signal($signal, $f = function ($signal) use (&$f) {
3636
$this->signals->call($signal);
37+
// Ensure there are two copies of the callable around until it has been executed.
38+
// For more information see: https://bugs.php.net/bug.php?id=62452
39+
// Only an issue for PHP 5, this hack can be removed once PHP 5 suppose has been dropped.
40+
$g = $f;
41+
$f = $g;
3742
});
3843
},
3944
function ($signal) {

0 commit comments

Comments
 (0)
0