ZF-8099: Problem is always here in 1.9.4

Issue Type: Sub-task Created: 2009-10-19T12:03:56.000+0000 Last Updated: 2009-10-19T12:41:40.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: thomas (thomas963) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter

Related issues: Attachments:



The problem is always here in the 1.9.4 version (and 1.9.3 and maybe before...). It is a blocker problem as null value are transformed in empty string (especially for database storing, where you need often to keep null type, in my case for an optional date for exemple)

How to recreate:

Zend_Loader::loadClass('Zend_Filter_Input'); $filters = array( '*' => 'StringTrim' // try to comment and decomment this line );

$validators = array( 'date' => array(array('Regex', '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/'), 'allowEmpty' => true), );

$datas['date'] = null; $input = new Zend_Filter_Input($filters, $validators, $datas);

var_dump($datas); // here date is null, so ok. $datas_valid = $input->getUnescaped(); var_dump($datas_valid); // here date is string(0) or null, depending the comment or decomment of the stringtrim filter... should always be null ! // And for my application string(0) give me an SQL error as date can only be date format or null (no date given) comming from a web form.

Cheers, Thomas


Posted by Thomas Weidner (thomas) on 2009-10-19T12:29:40.000+0000

Of course... getUnescaped() is used to get the value unescaped for output within the view. I see no reason why an value within the view should be null when it's casted to string.

Why don't you use Zend_Filter_Null when you need a NULL value ?

Posted by Thomas Weidner (thomas) on 2009-10-19T12:41:40.000+0000

Subclassing an already fixed issue after 5 months is no good behaviour.

The component has changed several times since then and the description you gave does not conform the original issue.

Closing as not an issue for the original issue.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.