Browse Source

Fixed VarDumper::dump for objects

Otherwise it throws an exception that "Object of class ClassName
could not be converted to string"
tags/2.0.0-beta
Rinat Silnov 12 years ago
parent
commit
1a317ebe31
  1. 2
      framework/helpers/base/VarDumper.php
  2. 12
      tests/unit/framework/helpers/VarDumperTest.php

2
framework/helpers/base/VarDumper.php

@ -116,7 +116,7 @@ class VarDumper
} elseif (self::$_depth <= $level) {
self::$_output .= get_class($var) . '(...)';
} else {
$id = self::$_objects[] = $var;
$id = array_push(self::$_objects, $var);
$className = get_class($var);
$members = (array)$var;
$spaces = str_repeat(' ', $level * 4);

12
tests/unit/framework/helpers/VarDumperTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\helpers;
use \yii\helpers\VarDumper;
class VarDumperTest extends \yii\test\TestCase
{
public function testDumpObject()
{
$obj = new \StdClass();
VarDumper::dump($obj);
}
}
Loading…
Cancel
Save