Skip to content

Commit 3f75c88

Browse files
authored
Merge pull request #33 from clue-labs/trace
Avoid PHP warnings due to lack of args in exception trace on PHP 7.4
2 parents 04fdcc5 + e594d08 commit 3f75c88

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/ProxyConnector.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,19 @@ public function connect($uri)
253253
$r = new \ReflectionProperty('Exception', 'trace');
254254
$r->setAccessible(true);
255255
$trace = $r->getValue($e);
256+
257+
// Exception trace arguments are not available on some PHP 7.4 installs
258+
// @codeCoverageIgnoreStart
256259
foreach ($trace as &$one) {
257-
foreach ($one['args'] as &$arg) {
258-
if ($arg instanceof \Closure) {
259-
$arg = 'Object(' . get_class($arg) . ')';
260+
if (isset($one['args'])) {
261+
foreach ($one['args'] as &$arg) {
262+
if ($arg instanceof \Closure) {
263+
$arg = 'Object(' . get_class($arg) . ')';
264+
}
260265
}
261266
}
262267
}
268+
// @codeCoverageIgnoreEnd
263269
$r->setValue($e, $trace);
264270
});
265271

0 commit comments

Comments
 (0)