diff --git a/src/Dev/CliDebugView.php b/src/Dev/CliDebugView.php index 86c87422f..b2d25fa27 100644 --- a/src/Dev/CliDebugView.php +++ b/src/Dev/CliDebugView.php @@ -160,7 +160,7 @@ class CliDebugView extends DebugView public function debugVariableText($val) { // Check debug - if (ClassInfo::hasMethod($val, 'debug')) { + if (is_object($val) && ClassInfo::hasMethod($val, 'debug')) { return $val->debug(); } diff --git a/tests/php/Dev/CLIDebugViewTest.php b/tests/php/Dev/CLIDebugViewTest.php index 8729def03..7d8d06661 100644 --- a/tests/php/Dev/CLIDebugViewTest.php +++ b/tests/php/Dev/CLIDebugViewTest.php @@ -61,5 +61,16 @@ EOS , $view->debugVariable(new ObjectWithDebug(), $this->caller) ); + + $this->assertEquals( + <<debugVariable(ObjectWithDebug::class, $this->caller) + ); } }