ZF-123: Zend_Filter_Input doesn't check if requested key exists (TRAC#142)

Description

http://framework.zend.com/developer/ticket/142

When we work in a STRICT mode and put a $_POST array to constructor and we have no longer access to those data then it is not possible to check if the key was send in request. When we work in a non-STRICT mode we could first check if the key was send (eg. if (array_key_exists('my_key', $_POST){...}) and then filter this data through Zend_Filter_Input but then we keep data in 2 copies ($_POST and Zend_Filter_Input::_source). I suggest checking if requested key exists in each method or adding new method eg. existsKey().

Comments

06/14/06 17:47:39: Modified by gavin

http://framework.zend.com/developer/browser/…

The new router (in version 0.1.4) will cleanly distinguish between:

?foo=bar ?foo= ?

Although not exactly the same issue, the final solution for both Zend_Controller_Action and Zend_Input_Filter should have consistent semantics. For example, null indicates parameter not available/given, an empty string indicates the parameter was supplied / is available, and a non-empty string would contain the value of the parameter.

References:

* <a rel="nofollow" href="http://www.zend.com/lists/fw-general/200606/msg00447.html">http://zend.com/lists/fw-general/&hellip;</a>
* #90 

06/14/06 18:15:43: Modified by gavin

We should be able to distinguish between the absense or presence of an input parameter.

If Zend_Input_Filter is altered, the rationale in the documentation might also need updating: http://framework.zend.com/manual/en/…

Patch to resolve most problems.

Adds the keyExists function as well as ensures that no notices are thrown in strict mode by using array_key_exists first.

Patch attached. Would prefer this makes 0.1.4.

Updated fix version/affects version as it may have gotten into scm too late to make the 0.1.4 rls. Original patch was submitted june 14. I dont have karma on this component so can't commit it if the patch is approved.

Check and apply patch

fixed by SVN revision 807

0.1.5 released