diff --git a/src/Dev/DebugView.php b/src/Dev/DebugView.php index b08586c8c..24200bf8e 100644 --- a/src/Dev/DebugView.php +++ b/src/Dev/DebugView.php @@ -421,7 +421,7 @@ class 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/DebugViewTest.php b/tests/php/Dev/DebugViewTest.php index e9d296c39..edafe8bff 100644 --- a/tests/php/Dev/DebugViewTest.php +++ b/tests/php/Dev/DebugViewTest.php @@ -31,7 +31,7 @@ class DebugViewTest extends SapphireTest <<
-

Debug (DebugViewTest.php:17 - SilverStripe\Dev\Tests\DebugViewTest::setUp()) +

Debug (DebugViewTest.php:17 - SilverStripe\\Dev\\Tests\\DebugViewTest::setUp())

string
@@ -44,7 +44,7 @@ EOS <<
-

Debug (DebugViewTest.php:17 - SilverStripe\Dev\Tests\DebugViewTest::setUp()) +

Debug (DebugViewTest.php:17 - SilverStripe\\Dev\\Tests\\DebugViewTest::setUp())