Zend Framework

Default escaper modifies NULL values into empty strings

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.1
  • Fix Version/s: 1.8.0
  • Component/s: Zend_Filter_Input
  • Labels:
    None
  • Fix Version Priority:
    Nice to Have

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;
    	}
     ....
     }

Activity

Hide
Wil Sinclair added a comment -

Please evaluate and categorize/assign as necessary.

Show
Wil Sinclair added a comment - Please evaluate and categorize/assign as necessary.
Hide
Benjamin Eberlei added a comment -

Fixed in trunk as of r12669

Show
Benjamin Eberlei added a comment - Fixed in trunk as of r12669

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: