ZF-3004: Default escaper modifies NULL values into empty strings

Description

When using the Zend_Filter_Input component it is usually in preparation for database insert/update queries. Sometimes it is necessary to pass a NULL value in such a query (for example, to reset a previously set field that is NULL by default). Unfortunately the default escaper, htmlentities, converts NULL values into empty strings which prevents such data from passing a Zend_Filter_Input process.

This could be seen as a PHP bug (why is null converted to empty string?) but as it stands it should be possible to pass null values through a Zend_Filter_Input.

I've created a temporary patch in my local build of the framework (1.5.1)

Zend_Filter_Input.php, line 349:


protected function _escapeRecursive($data)
    {
        if(is_null($data)){
            return $data;
        }
     ....
     }    

Comments

Please evaluate and categorize/assign as necessary.

Fixed in trunk as of r12669