From b09689270b68826d1d94c8863f69fe4e02a42a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Thu, 11 Jun 2020 12:24:35 +0200 Subject: [PATCH] Avoid PHP warnings due to lack of args in exception trace on PHP 7.4 --- src/Query/RetryExecutor.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Query/RetryExecutor.php b/src/Query/RetryExecutor.php index ded5c67a..d9cbfe56 100644 --- a/src/Query/RetryExecutor.php +++ b/src/Query/RetryExecutor.php @@ -53,13 +53,19 @@ public function tryQuery(Query $query, $retries) $r = new \ReflectionProperty('Exception', 'trace'); $r->setAccessible(true); $trace = $r->getValue($e); + + // Exception trace arguments are not available on some PHP 7.4 installs + // @codeCoverageIgnoreStart foreach ($trace as &$one) { - foreach ($one['args'] as &$arg) { - if ($arg instanceof \Closure) { - $arg = 'Object(' . \get_class($arg) . ')'; + if (isset($one['args'])) { + foreach ($one['args'] as &$arg) { + if ($arg instanceof \Closure) { + $arg = 'Object(' . \get_class($arg) . ')'; + } } } } + // @codeCoverageIgnoreEnd $r->setValue($e, $trace); } else { --$retries;