diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index b57dcf932..40a7ef3d4 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -325,8 +325,43 @@ object(View) { elementCacheSettings => array() int => (int) 2 float => (float) 1.333 + +TEXT; + if (version_compare(PHP_VERSION, '5.3.0') >= 0) { + $expected .= << array( + (int) 0 => 'viewVars', + (int) 1 => 'autoLayout', + (int) 2 => 'ext', + (int) 3 => 'helpers', + (int) 4 => 'view', + (int) 5 => 'layout', + (int) 6 => 'name', + (int) 7 => 'theme', + (int) 8 => 'layoutPath', + (int) 9 => 'viewPath', + (int) 10 => 'request', + (int) 11 => 'plugin', + (int) 12 => 'passedArgs', + (int) 13 => 'cacheAction' + ) + [protected] _scripts => array() + [protected] _paths => array() + [protected] _helpersLoaded => false + [protected] _parents => array() + [protected] _current => null + [protected] _currentType => '' + [protected] _stack => array() + [protected] _eventManager => object(CakeEventManager) {} + [protected] _eventManagerConfigured => false + [private] __viewFileName => null + +TEXT; + } + $expected .= <<assertTextEquals($expected, $result); $data = array( diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index 319701fe2..87ba9ca1c 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -576,6 +576,31 @@ class Debugger { $value = self::_export($value, $depth - 1, $indent); $props[] = "$key => " . $value; } + + if (version_compare(PHP_VERSION, '5.3.0') >= 0) { + $ref = new ReflectionObject($var); + + $reflectionProperties = $ref->getProperties(ReflectionProperty::IS_PROTECTED); + foreach ($reflectionProperties as $reflectionProperty) { + $reflectionProperty->setAccessible(true); + $property = $reflectionProperty->getValue($var); + + $value = self::_export($property, $depth - 1, $indent); + $key = $reflectionProperty->name; + $props[] = "[protected] $key => " . $value; + } + + $reflectionProperties = $ref->getProperties(ReflectionProperty::IS_PRIVATE); + foreach ($reflectionProperties as $reflectionProperty) { + $reflectionProperty->setAccessible(true); + $property = $reflectionProperty->getValue($var); + + $value = self::_export($property, $depth - 1, $indent); + $key = $reflectionProperty->name; + $props[] = "[private] $key => " . $value; + } + } + $out .= $break . implode($break, $props) . $end; } $out .= '}';