Index: library/Zend/CodeGenerator/Php/Property/DefaultValue.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+><?php\n/**\n * Zend Framework\n *\n * LICENSE\n *\n * This source file is subject to the new BSD license that is bundled\n * with this package in the file LICENSE.txt.\n * It is also available through the world-wide-web at this URL:\n * http://framework.zend.com/license/new-bsd\n * If you did not receive a copy of the license and are unable to\n * obtain it through the world-wide-web, please send an email\n * to license@zend.com so we can send you a copy immediately.\n *\n * @category   Zend\n * @package    Zend_CodeGenerator\n * @subpackage PHP\n * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)\n * @license    http://framework.zend.com/license/new-bsd     New BSD License\n * @version    $Id: DefaultValue.php 24594 2012-01-05 21:27:01Z matthew $\n */\n\n/**\n * @see Zend_CodeGenerator_Php_Abstract\n */\nrequire_once 'Zend/CodeGenerator/Php/Abstract.php';\n\n/**\n * @category   Zend\n * @package    Zend_CodeGenerator\n * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)\n * @license    http://framework.zend.com/license/new-bsd     New BSD License\n */\nclass Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Php_Abstract\n{\n    /**#@+\n     * Constant values\n     */\n    const TYPE_AUTO     = 'auto';\n    const TYPE_BOOLEAN  = 'boolean';\n    const TYPE_BOOL     = 'bool';\n    const TYPE_NUMBER   = 'number';\n    const TYPE_INTEGER  = 'integer';\n    const TYPE_INT      = 'int';\n    const TYPE_FLOAT    = 'float';\n    const TYPE_DOUBLE   = 'double';\n    const TYPE_STRING   = 'string';\n    const TYPE_ARRAY    = 'array';\n    const TYPE_CONSTANT = 'constant';\n    const TYPE_NULL     = 'null';\n    const TYPE_OTHER    = 'other';\n    /**#@-*/\n\n    /**\n     * @var array of reflected constants\n     */\n    protected static $_constants = array();\n\n    /**\n     * @var mixed\n     */\n    protected $_value = null;\n\n    /**\n     * @var string\n     */\n    protected $_type  = self::TYPE_AUTO;\n\n    /**\n     * @var int\n     */\n    protected $_arrayDepth = 1;\n\n    /**\n     * _init()\n     *\n     * This method will prepare the constant array for this class\n     */\n    protected function _init()\n    {\n        if(count(self::$_constants) == 0) {\n            $reflect = new ReflectionClass(get_class($this));\n            self::$_constants = $reflect->getConstants();\n            unset($reflect);\n        }\n    }\n\n    /**\n     * isValidConstantType()\n     *\n     * @return bool\n     */\n    public function isValidConstantType()\n    {\n        if ($this->_type == self::TYPE_AUTO) {\n            $type = $this->_getAutoDeterminedType($this->_value);\n        } else {\n            $type = $this->_type;\n        }\n\n        // valid types for constants\n        $scalarTypes = array(\n            self::TYPE_BOOLEAN,\n            self::TYPE_BOOL,\n            self::TYPE_NUMBER,\n            self::TYPE_INTEGER,\n            self::TYPE_INT,\n            self::TYPE_FLOAT,\n            self::TYPE_DOUBLE,\n            self::TYPE_STRING,\n            self::TYPE_CONSTANT,\n            self::TYPE_NULL\n            );\n\n        return in_array($type, $scalarTypes);\n    }\n\n    /**\n     * setValue()\n     *\n     * @param mixed $value\n     * @return Zend_CodeGenerator_Php_Property_DefaultValue\n     */\n    public function setValue($value)\n    {\n        $this->_value = $value;\n        return $this;\n    }\n\n    /**\n     * getValue()\n     *\n     * @return mixed\n     */\n    public function getValue()\n    {\n        return $this->_value;\n    }\n\n    /**\n     * setType()\n     *\n     * @param string $type\n     * @return Zend_CodeGenerator_Php_Property_DefaultValue\n     */\n    public function setType($type)\n    {\n        $this->_type = $type;\n        return $this;\n    }\n\n    /**\n     * getType()\n     *\n     * @return string\n     */\n    public function getType()\n    {\n        return $this->_type;\n    }\n\n    /**\n     * setArrayDepth()\n     *\n     * @param int $arrayDepth\n     * @return Zend_CodeGenerator_Php_Property_DefaultValue\n     */\n    public function setArrayDepth($arrayDepth)\n    {\n        $this->_arrayDepth = $arrayDepth;\n        return $this;\n    }\n\n    /**\n     * getArrayDepth()\n     *\n     * @return int\n     */\n    public function getArrayDepth()\n    {\n        return $this->_arrayDepth;\n    }\n\n    /**\n     * _getValidatedType()\n     *\n     * @param string $type\n     * @return string\n     */\n    protected function _getValidatedType($type)\n    {\n        if (($constName = array_search($type, self::$_constants)) !== false) {\n            return $type;\n        }\n\n        return self::TYPE_AUTO;\n    }\n\n    /**\n     * _getAutoDeterminedType()\n     *\n     * @param mixed $value\n     * @return string\n     */\n    public function _getAutoDeterminedType($value)\n    {\n        switch (gettype($value)) {\n            case 'boolean':\n                return self::TYPE_BOOLEAN;\n            case 'integer':\n                return self::TYPE_INT;\n            case 'string':\n                return self::TYPE_STRING;\n            case 'double':\n            case 'float':\n            case 'integer':\n                return self::TYPE_NUMBER;\n            case 'array':\n                return self::TYPE_ARRAY;\n            case 'NULL':\n                return self::TYPE_NULL;\n            case 'object':\n            case 'resource':\n            case 'unknown type':\n            default:\n                return self::TYPE_OTHER;\n        }\n    }\n\n    /**\n     * generate()\n     *\n     * @return string\n     */\n    public function generate()\n    {\n        $type = $this->_type;\n\n        if ($type != self::TYPE_AUTO) {\n            $type = $this->_getValidatedType($type);\n        }\n\n        $value = $this->_value;\n\n        if ($type == self::TYPE_AUTO) {\n            $type = $this->_getAutoDeterminedType($value);\n\n            if ($type == self::TYPE_ARRAY) {\n                $rii = new RecursiveIteratorIterator(\n                    $it = new RecursiveArrayIterator($value),\n                    RecursiveIteratorIterator::SELF_FIRST\n                    );\n                foreach ($rii as $curKey => $curValue) {\n                    if (!$curValue instanceof Zend_CodeGenerator_Php_Property_DefaultValue) {\n                        $curValue = new self(array('value' => $curValue));\n                        $rii->getSubIterator()->offsetSet($curKey, $curValue);\n                    }\n                    $curValue->setArrayDepth($rii->getDepth());\n                }\n                $value = $rii->getSubIterator()->getArrayCopy();\n            }\n\n        }\n\n        $output = '';\n\n        switch ($type) {\n            case self::TYPE_BOOLEAN:\n            case self::TYPE_BOOL:\n                $output .= ( $value ? 'true' : 'false' );\n                break;\n            case self::TYPE_STRING:\n                $output .= \"'\" . addcslashes($value, \"'\") . \"'\";\n                break;\n            case self::TYPE_NULL:\n                $output .= 'null';\n                break;\n            case self::TYPE_NUMBER:\n            case self::TYPE_INTEGER:\n            case self::TYPE_INT:\n            case self::TYPE_FLOAT:\n            case self::TYPE_DOUBLE:\n            case self::TYPE_CONSTANT:\n                $output .= $value;\n                break;\n            case self::TYPE_ARRAY:\n                $output .= 'array(';\n                $curArrayMultiblock = false;\n                if (count($value) > 1) {\n                    $curArrayMultiblock = true;\n                    $output .= PHP_EOL . str_repeat($this->_indentation, $this->_arrayDepth+1);\n                }\n                $outputParts = array();\n                $noKeyIndex = 0;\n                foreach ($value as $n => $v) {\n                    $v->setArrayDepth($this->_arrayDepth + 1);\n                    $partV = $v->generate();\n                    $partV = substr($partV, 0, strlen($partV)-1);\n                    if ($n === $noKeyIndex) {\n                        $outputParts[] = $partV;\n                        $noKeyIndex++;\n                    } else {\n                        $outputParts[] = (is_int($n) ? $n : \"'\" . addcslashes($n, \"'\") . \"'\") . ' => ' . $partV;\n                    }\n\n                }\n                $output .= implode(',' . PHP_EOL . str_repeat($this->_indentation, $this->_arrayDepth+1), $outputParts);\n                if ($curArrayMultiblock == true) {\n                    $output .= PHP_EOL . str_repeat($this->_indentation, $this->_arrayDepth+1);\n                }\n                $output .= ')';\n                break;\n            case self::TYPE_OTHER:\n            default:\n                require_once \"Zend/CodeGenerator/Php/Exception.php\";\n                throw new Zend_CodeGenerator_Php_Exception(\n                    \"Type '\".get_class($value).\"' is unknown or cannot be used as property default value.\"\n                );\n        }\n\n        $output .= ';';\n\n        return $output;\n    }\n}\n
===================================================================
--- library/Zend/CodeGenerator/Php/Property/DefaultValue.php	(revision 074950dcf4f71b617a9bbd279bd3bc299423952a)
+++ library/Zend/CodeGenerator/Php/Property/DefaultValue.php	(revision )
@@ -244,23 +244,22 @@
 
         if ($type == self::TYPE_AUTO) {
             $type = $this->_getAutoDeterminedType($value);
+        }
 
-            if ($type == self::TYPE_ARRAY) {
-                $rii = new RecursiveIteratorIterator(
-                    $it = new RecursiveArrayIterator($value),
-                    RecursiveIteratorIterator::SELF_FIRST
-                    );
-                foreach ($rii as $curKey => $curValue) {
-                    if (!$curValue instanceof Zend_CodeGenerator_Php_Property_DefaultValue) {
-                        $curValue = new self(array('value' => $curValue));
-                        $rii->getSubIterator()->offsetSet($curKey, $curValue);
-                    }
-                    $curValue->setArrayDepth($rii->getDepth());
-                }
-                $value = $rii->getSubIterator()->getArrayCopy();
+	    if ($type == self::TYPE_ARRAY) {
+		    $rii = new RecursiveIteratorIterator(
+			    $it = new RecursiveArrayIterator($value),
+			    RecursiveIteratorIterator::SELF_FIRST
+		    );
+		    foreach ($rii as $curKey => $curValue) {
+			    if (!$curValue instanceof Zend_CodeGenerator_Php_Property_DefaultValue) {
+				    $curValue = new self(array('value' => $curValue));
+				    $rii->getSubIterator()->offsetSet($curKey, $curValue);
+			    }
+			    $curValue->setArrayDepth($rii->getDepth());
+		    }
+		    $value = $rii->getSubIterator()->getArrayCopy();
-            }
-
-        }
+	    }
 
         $output = '';
 
