Search code examples
phpzend-frameworkformszend-decorators

Zend passing string containing "Zero" to form-element Description


Zend talk. I built a Zend_Form class. I noticed that if I pass the string '0' the method setDescription of my form-element will consider it as NULL and I can't get to echo out its value in the element description.

//this is how I set the element description in Myform class:
$element->setDescription('0');

How can I avoid that?

Thanks

Luca


Solution

  • According to http://php.net/manual/en/function.empty.php, php recognizes '0' as empty.

    The Description decorator render() function checks to see if the description is empty(). There doesn't currently appear to be a way to display just a '0'.

    I'd suggest filing a bug report at http://framework.zend.com/issues

    Until that gets changed, your best bet is to create your own Description decorator which extends the Zend one and changes the behavior.