mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #2244 from dereuromark/2.5-debugger
Pass depth through for Debugger::dump().
This commit is contained in:
commit
d6f5f2f0bb
2 changed files with 18 additions and 2 deletions
|
@ -508,6 +508,21 @@ TEXT;
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
){$close}
|
){$close}
|
||||||
|
TEXT;
|
||||||
|
$this->assertTextEquals($expected, $result);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
Debugger::dump($var, 1);
|
||||||
|
$result = ob_get_clean();
|
||||||
|
|
||||||
|
$open = php_sapi_name() == 'cli' ? "\n" : '<pre>';
|
||||||
|
$close = php_sapi_name() == 'cli' ? "\n" : '</pre>';
|
||||||
|
$expected = <<<TEXT
|
||||||
|
{$open}array(
|
||||||
|
'People' => array(
|
||||||
|
[maximum depth reached]
|
||||||
|
)
|
||||||
|
){$close}
|
||||||
TEXT;
|
TEXT;
|
||||||
$this->assertTextEquals($expected, $result);
|
$this->assertTextEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,12 +172,13 @@ class Debugger {
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param mixed $var the variable to dump
|
* @param mixed $var the variable to dump
|
||||||
|
* @param int $depth The depth to output to. Defaults to 3.
|
||||||
* @return void
|
* @return void
|
||||||
* @see Debugger::exportVar()
|
* @see Debugger::exportVar()
|
||||||
* @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::dump
|
* @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::dump
|
||||||
*/
|
*/
|
||||||
public static function dump($var) {
|
public static function dump($var, $depth = 3) {
|
||||||
pr(self::exportVar($var));
|
pr(self::exportVar($var, $depth));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue