Skip to content

Commit

Permalink
Implement proper fix for the OPCache issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Jul 1, 2017
1 parent c1c552d commit d382d71
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Internal/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,11 @@ public function ask(Question $question, int $timeout): Promise {

try {
// Work around an OPCache issue that returns an empty array with "return yield ...",
// so assign to a variable first.
// so assign to a variable first and return after the try block.
//
// See https://github.com/amphp/dns/issues/58.
// See https://bugs.php.net/bug.php?id=74840.
$result = yield Promise\timeout($deferred->promise(), $timeout);
return $result;
} catch (Amp\TimeoutException $exception) {
unset($this->pending[$id]);

Expand All @@ -178,6 +177,8 @@ public function ask(Question $question, int $timeout): Promise {
$deferred->resolve();
}
}

return $result;
});
}

Expand Down

0 comments on commit d382d71

Please sign in to comment.