Issues

ZF-8849: PHP Notice: Undefined variable: type in Zend/CodeGenerator/Php/Property/DefaultValue.php on line 113

Description

Hi everybody,

I think I've found a bug in Zend/CodeGenerator/Php/Property/DefaultValue.php: Shouldn't the method isValidConstantType look like this:


    public function isValidConstantType()
    {
        if ($this->_type == self::TYPE_AUTO) {
            $type = $this->_getAutoDeterminedType($this->_value);
        } else {
            $type = $this->_type;
        }

        // valid types for constants
        $scalarTypes = array(
            self::TYPE_BOOLEAN,
            self::TYPE_BOOL,
            self::TYPE_NUMBER,
            self::TYPE_INTEGER,
            self::TYPE_INT,
            self::TYPE_FLOAT,
            self::TYPE_DOUBLE,
            self::TYPE_STRING,
            self::TYPE_CONSTANT,
            self::TYPE_NULL
            );

        return in_array($type, $scalarTypes);
    }

Sorry if not all line breaks are correctly, copy&paste did not work that good this time...

Best regards,

Paul

Comments

Fixed in r21979.