ZF-7631: Zend_Validate_NotEmpty compatibility
Description
Zend_Validate_NotEmpty doesn't accept anything else then string, int, float, bool but it was. Now object, arrays, etc are returnd as "empty"
Zend_Validate_NotEmpty doesn't accept anything else then string, int, float, bool but it was. Now object, arrays, etc are returnd as "empty"
Comments
Posted by Thomas Weidner (thomas) on 2009-08-18T23:55:20.000+0000
No they're not. You should look which sort of failure is returned.
In the above case you get "Invalid type given, value should be float, string, or integer".
I agree that Arrays are missing. But a object can never be empty. To check a object for emptyness is quite useless and in my eyes a failure. Same for ressources.
Posted by Edi Skraba (edspiner) on 2009-08-19T01:53:16.000+0000
About objects:
What if i have such code:
{{$value = ($_POST['value']) ? new Zend_Date($_POST['value']) : null;}}
And im checking: {{Zend_Validate::is($value,'NotEmpty')}}
I know that i can make a different solution but - as above - i don't know what's the type of $value - i just wan't to check if it's "NotEmpty".
As You said the objects are never empty so it could bo something like: {{if(is_object($value)) return true;}}
Posted by Thomas Weidner (thomas) on 2009-08-19T13:08:38.000+0000
Fixed...
Allowed arrays. Objects and Ressources are disallowed.
Posted by Thomas Baumann (t11n) on 2010-06-09T05:53:59.000+0000
Please see ZF-9968