ZF-8099: Problem is always here in 1.9.4

Description

Hello,

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

Comments

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 ?

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.