From e0fc018ad7473cd24b188323393476c5a19a6d35 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Sat, 1 Jul 2017 10:52:56 +0200 Subject: [PATCH] Work around OPCache issue --- lib/Internal/Socket.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Internal/Socket.php b/lib/Internal/Socket.php index 3fe0720..5aab30b 100644 --- a/lib/Internal/Socket.php +++ b/lib/Internal/Socket.php @@ -157,7 +157,10 @@ abstract class Socket { } try { - return yield Promise\timeout($deferred->promise(), $timeout); + // Work around an OPCache issue that returns an empty array with "return yield ...", so assign to a variable first. + // See https://github.com/amphp/dns/issues/58. + $result = yield Promise\timeout($deferred->promise(), $timeout); + return $result; } catch (Amp\TimeoutException $exception) { unset($this->pending[$id]);