Skip to content

Commit

Permalink
Fixed error handling when InteractiveDebug is used outside Component…
Browse files Browse the repository at this point in the history
… class (#292)

* [Composer] Disabled php-http/discovery plugin

* Fixed error handling when InteractiveDebug is used outside Component class
  • Loading branch information
mnocon authored Aug 23, 2023
1 parent 72aa5aa commit ca1e27b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
"bin": ["bin/ibexabehat", "bin/ibexareport"],
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true
"composer/package-versions-deprecated": true,
"php-http/discovery": false
}
}
}
6 changes: 5 additions & 1 deletion src/lib/Core/Debug/InteractiveDebuggerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ private function getCallingComponent(): Component
{
$trace = debug_backtrace();
foreach ($trace as $traceLine) {
if ($traceLine['function'] === 'eval') {
if (!array_key_exists('function', $traceLine) ||
$traceLine['function'] === 'eval' ||
!array_key_exists('object', $traceLine)
) {
continue;
}

$object = $traceLine['object'];
if ($object instanceof Component) {
return $object;
Expand Down

0 comments on commit ca1e27b

Please sign in to comment.