diff --git a/cake/libs/debugger.php b/cake/libs/debugger.php index ed2fa0126..1ef6571a3 100644 --- a/cake/libs/debugger.php +++ b/cake/libs/debugger.php @@ -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) || is_array($value)) { - $serialized = serialize($value); - - if(in_array($serialized, $history, true)) { - $value = ife(is_object($value), "*RECURSION* -> " . get_class($value), "*RECURSION*"); - } - } - 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()"; + 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); } + $out[] = "$className::$$key = " . $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 diff --git a/cake/tests/cases/libs/debugger.test.php b/cake/tests/cases/libs/debugger.test.php index 28143af03..7a10dd14a 100644 --- a/cake/tests/cases/libs/debugger.test.php +++ b/cake/tests/cases/libs/debugger.test.php @@ -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);