ZF-7804: Invalid property specification if "defaultValue" is NULL
Description
echo new Zend_CodeGenerator_Php_Class(array(
'name' => 'Foobar',
'properties' => array(
new Zend_CodeGenerator_Php_Property(array(
'name' => '_dummy',
'visibility' => Zend_CodeGenerator_Php_Property::VISIBILITY_PROTECTED,
'defaultValue' => NULL
))
)
));
class Foobar {
protected $_dummy = NULL;
}
class Foobar {
protected $_dummy = ;
}
Comments
Posted by Jan Pieper (jpieper) on 2009-09-08T20:09:18.000+0000
Added diff to fix this bug.
Posted by Benjamin Eberlei (beberlei) on 2009-09-09T00:40:53.000+0000
This is a duplicate of ZF-6722, its fixed in trunk and 1.9 release branch, which means it will be included in 1.9.3
Posted by Jan Pieper (jpieper) on 2009-09-09T03:53:25.000+0000
Why is it duplicate? Zend_CodeGenerator_Php_Parameter is not Zend_CodeGenerator_Php_Property. It is the same problem but located in different classes. And it seems to not be fixed in svn.
Posted by Benjamin Eberlei (beberlei) on 2009-09-09T04:59:01.000+0000
Ah ok, well its sort of a duplicate, there is another issue that fixes the parameter thing.
You have to call:
however the method, setDefaultValue could do that internally also like its done inside the parameter method. I'll add that
Posted by Jan Pieper (jpieper) on 2009-09-10T13:48:35.000+0000
Zend_CodeGenerator_Php_Property_DefaultValue has no own constructor. It's only a luck break that it generates "NULL" as result. Following example will also result in "NULL".