mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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
This commit is contained in:
parent
454fae9bd0
commit
0a182b918f
2 changed files with 24 additions and 1 deletions
|
@ -343,6 +343,21 @@ array(
|
|||
(int) 1 => 'Index one',
|
||||
(int) 5 => 'Index five'
|
||||
)
|
||||
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 @@ TEXT;
|
|||
<pre>array(
|
||||
'People' => array(
|
||||
(int) 0 => array(
|
||||
'name' => 'joeseph',
|
||||
'coat' => 'technicolor',
|
||||
'hair_color' => 'brown'
|
||||
),
|
||||
(int) 1 => array(
|
||||
'name' => 'Shaft',
|
||||
'coat' => 'black',
|
||||
'hair' => 'black'
|
||||
)
|
||||
)
|
||||
)</pre>
|
||||
|
|
|
@ -544,8 +544,10 @@ class Debugger {
|
|||
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 . ')';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue