Commit 1a317ebe by Rinat Silnov

Fixed VarDumper::dump for objects

Otherwise it throws an exception that "Object of class ClassName could not be converted to string"
parent d8beaa64
...@@ -116,7 +116,7 @@ class VarDumper ...@@ -116,7 +116,7 @@ class VarDumper
} elseif (self::$_depth <= $level) { } elseif (self::$_depth <= $level) {
self::$_output .= get_class($var) . '(...)'; self::$_output .= get_class($var) . '(...)';
} else { } else {
$id = self::$_objects[] = $var; $id = array_push(self::$_objects, $var);
$className = get_class($var); $className = get_class($var);
$members = (array)$var; $members = (array)$var;
$spaces = str_repeat(' ', $level * 4); $spaces = str_repeat(' ', $level * 4);
......
<?php
namespace yiiunit\framework\helpers;
use \yii\helpers\VarDumper;
class VarDumperTest extends \yii\test\TestCase
{
public function testDumpObject()
{
$obj = new \StdClass();
VarDumper::dump($obj);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment