mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Simplifying default Debugger output, fixes #4066
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6692 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
3e28323667
commit
fc92ea039a
2 changed files with 25 additions and 61 deletions
|
@ -357,7 +357,7 @@ class Debugger extends Object {
|
|||
break;
|
||||
case 'string':
|
||||
if (trim($var) == "") {
|
||||
return '"[empty string]"';
|
||||
return '""';
|
||||
}
|
||||
return '"' . h($var) . '"';
|
||||
break;
|
||||
|
@ -394,42 +394,25 @@ class Debugger extends Object {
|
|||
* @access private
|
||||
*/
|
||||
function __object($var) {
|
||||
static $history = array();
|
||||
$serialized = serialize($var);
|
||||
array_push($history, $serialized);
|
||||
$out = array();
|
||||
|
||||
if(is_object($var)) {
|
||||
$className = get_class($var);
|
||||
$objectVars = get_object_vars($var);
|
||||
|
||||
foreach($objectVars as $key => $value) {
|
||||
$inline = null;
|
||||
if(strpos($key, '_', 0) !== 0) {
|
||||
$inline = "$className::$key = ";
|
||||
if(is_object($value)) {
|
||||
$value = get_class($value) . ' object';
|
||||
} elseif (is_array($value)) {
|
||||
$value = 'array';
|
||||
} elseif ($value === null) {
|
||||
$value = 'NULL';
|
||||
} elseif (in_array(gettype($value), array('boolean', 'integer', 'double', 'string', 'array', 'resource'))) {
|
||||
$value = Debugger::exportVar($value);
|
||||
}
|
||||
|
||||
if(is_object($value) || is_array($value)) {
|
||||
$serialized = serialize($value);
|
||||
|
||||
if(in_array($serialized, $history, true)) {
|
||||
$value = ife(is_object($value), "*RECURSION* -> " . get_class($value), "*RECURSION*");
|
||||
$out[] = "$className::$$key = " . $value;
|
||||
}
|
||||
}
|
||||
if(in_array(gettype($value), array('boolean', 'integer', 'double', 'string', 'array', 'resource', 'object', 'null'))) {
|
||||
$out[] = "$className::$$key = " . Debugger::exportVar($value);
|
||||
} else {
|
||||
$out[] = "$className::$$key = " . var_export($value, true);
|
||||
}
|
||||
}
|
||||
|
||||
$objectMethods = get_class_methods($className);
|
||||
foreach($objectMethods as $key => $value) {
|
||||
if(strpos($value, '_', 0) !== 0) {
|
||||
$out[] = "$className::$value()";
|
||||
}
|
||||
}
|
||||
}
|
||||
array_pop($history);
|
||||
return join("\n", $out);
|
||||
}
|
||||
/**
|
||||
|
@ -525,7 +508,6 @@ class Debugger extends Object {
|
|||
$this->__data[] = compact('error', 'code', 'description', 'line', 'file', 'context', 'trace');
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Verify that the application's salt has been changed from the default value
|
||||
|
|
|
@ -83,14 +83,14 @@ class DebuggerTest extends UnitTestCase {
|
|||
$expected = 'ViewView::$base = NULL
|
||||
View::$here = NULL
|
||||
View::$plugin = NULL
|
||||
View::$name = "[empty string]"
|
||||
View::$name = ""
|
||||
View::$action = NULL
|
||||
View::$params = array()
|
||||
View::$passedArgs = array()
|
||||
View::$data = array()
|
||||
View::$helpers = array("Html","Form")
|
||||
View::$viewPath = "[empty string]"
|
||||
View::$viewVars = array()
|
||||
View::$params = array
|
||||
View::$passedArgs = array
|
||||
View::$data = array
|
||||
View::$helpers = array
|
||||
View::$viewPath = ""
|
||||
View::$viewVars = array
|
||||
View::$layout = "default"
|
||||
View::$layoutPath = NULL
|
||||
View::$pageTitle = false
|
||||
|
@ -100,39 +100,21 @@ class DebuggerTest extends UnitTestCase {
|
|||
View::$subDir = NULL
|
||||
View::$themeWeb = NULL
|
||||
View::$cacheAction = false
|
||||
View::$validationErrors = array()
|
||||
View::$validationErrors = array
|
||||
View::$hasRendered = false
|
||||
View::$loaded = array()
|
||||
View::$loaded = array
|
||||
View::$modelScope = false
|
||||
View::$model = NULL
|
||||
View::$association = NULL
|
||||
View::$field = NULL
|
||||
View::$fieldSuffix = NULL
|
||||
View::$modelId = NULL
|
||||
View::$uuids = array()
|
||||
View::$__passedVars = array("viewVars","action","autoLayout","autoRender","ext","base","webroot","helpers","here","layout","name","pageTitle","layoutPath","viewPath","params","data","plugin","passedArgs","cacheAction")
|
||||
View::$__scripts = array()
|
||||
View::$__paths = array()
|
||||
View::$uuids = array
|
||||
View::$__passedVars = array
|
||||
View::$__scripts = array
|
||||
View::$__paths = array
|
||||
View::$_log = NULL
|
||||
View::$webroot = NULL
|
||||
View::element()
|
||||
View::render()
|
||||
View::renderElement()
|
||||
View::renderLayout()
|
||||
View::renderCache()
|
||||
View::getVars()
|
||||
View::getVar()
|
||||
View::addScript()
|
||||
View::uuid()
|
||||
View::entity()
|
||||
View::set()
|
||||
View::error()
|
||||
View::Object()
|
||||
View::toString()
|
||||
View::requestAction()
|
||||
View::dispatchMethod()
|
||||
View::log()
|
||||
View::cakeError()';
|
||||
View::$webroot = NULL';
|
||||
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
|
||||
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
|
Loading…
Add table
Reference in a new issue