Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix $depth being decremented by 2.

$depth should only be decremented once for each step-in.
Add special text when values are being elided by maximum nesting level.

Fixes #2946
  • Loading branch information...
commit 0a182b918f2c3c61b6f0e8dc3c79bdaf0223c842 1 parent 454fae9
@markstory markstory authored
View
21 lib/Cake/Test/Case/Utility/DebuggerTest.php
@@ -345,6 +345,21 @@ public function testExportVar() {
)
TEXT;
$this->assertTextEquals($expected, $result);
+
+ $data = array(
+ 'key' => array(
+ 'value'
+ )
+ );
+ $result = Debugger::exportVar($data, 1);
+ $expected = <<<TEXT
+array(
+ 'key' => array(
+ [maximum depth reached]
+ )
+)
+TEXT;
+ $this->assertTextEquals($expected, $result);
}
/**
@@ -398,8 +413,14 @@ public function testDump() {
<pre>array(
'People' => array(
(int) 0 => array(
+ 'name' => 'joeseph',
+ 'coat' => 'technicolor',
+ 'hair_color' => 'brown'
),
(int) 1 => array(
+ 'name' => 'Shaft',
+ 'coat' => 'black',
+ 'hair' => 'black'
)
)
)</pre>
View
4 lib/Cake/Utility/Debugger.php
@@ -544,8 +544,10 @@ protected static function _array(array $var, $depth, $indent) {
foreach ($var as $key => $val) {
$vars[] = $break . self::exportVar($key) .
' => ' .
- self::_export($val, $depth - 1, $indent);
+ self::_export($val, $depth, $indent);
}
+ } else {
+ $vars[] = $break . '[maximum depth reached]';
}
return $out . implode(',', $vars) . $end . ')';
}
Please sign in to comment.
Something went wrong with that request. Please try again.