Hi Ralph, I just looked at the version of Zend_Validate_NotEmpty you pointed me to and it's working as expected now! Thank you
I'm a bit confused tough by which version is the most current in the svn. When I opened the issue in Jira (ZF-7843<http://framework.zend.com/issues/browse/ZF-7843>) I looked at the code from here: http://framework.zend.com/code/browse/Standard_Library/standard/trunk/library/Zend/Validate/NotEmpty.php (r18092 wasn't committed the last time I checked before opening the issue) In the last revision there's a fix to check for null values but it's different than the one you just pointed me to http://framework.zend.com/code/browse/Standard_Library/standard/branches/release-1.9/library/Zend/Validate/NotEmpty.php (r18104) I understand the idea behind branches but which one should I check to see if a fix has already been committed so I don't open issues needlessly? My understanding was that the trunk was the most up to date. Martin Carpentier On Tue, Sep 15, 2009 at 02:22, Ralph Schindler <[email protected]>wrote: > Sorry, I meant to check against this: > > http://framework.zend.com/svn/framework/standard/branches/release-1.9/ > > Cheers! > ralph > > > Ralph Schindler wrote: > >> Can you check this against 1.9.2? I think work has been done in this area >> and might have already been fixed. >> >> -ralph >> >> Martin Carpentier wrote: >> >>> Peter, >>> >>> Thank you for the reply. >>> >>> I'll open an issue then. >>> >>> >>> Martin Carpentier >>> >>> >>> On Sun, Sep 13, 2009 at 08:45, Peter Warnock <[email protected]<mailto: >>> [email protected]>> wrote: >>> >>> Based on your example, it looks like the backward compatibility was >>> broken. >>> >>> - pw >>> >>> >>> On Sat, Sep 12, 2009 at 7:20 AM, Martin Carpentier >>> <[email protected] <mailto:[email protected]>> >>> wrote: >>> >>> Hi, >>> >>> I made a previous post >>> < >>> http://www.nabble.com/Zend_Validate_NotEmpty-and-unchecked-radio-button-marked-as-required--fields-tt25278297.html> >>> >>> about this problem but never got any reply. I realize the title >>> was probably a bit unclear. >>> So here's my second attempt. >>> >>> Since ZF 1.9.x when you try to validate a null value with >>> Zend_Validate_NotEmpty you get the INVALID error message instead >>> of the IS_EMPTY error message. >>> >>> If you try: >>> >>> $value = null; >>> $validator = new Zend_Validate_NotEmpty(); >>> >>> Zend_Debug::dump($validator->isValid($value)); >>> Zend_Debug::dump($validator->getErrors()); >>> Zend_Debug::dump($validator->getMessages()); >>> >>> since ZF 1.9.x it results in: >>> >>> bool(false) >>> >>> array(1) { >>> [0] => string(15) "notEmptyInvalid" >>> } >>> >>> array(1) { >>> ["notEmptyInvalid"] => string(76) "Invalid type given, value >>> should be float, string, array, boolean or integer" >>> } >>> >>> before ZF 1.9.x it would result in: >>> >>> bool(false) >>> >>> array(1) { >>> [0] => string(7) "isEmpty" >>> } >>> >>> array(1) { >>> ["isEmpty"] => string(36) "Value is required and can't be empty" >>> } >>> >>> >>> I believe the expected behavior is to get the IS_EMPTY and not >>> the INVALID error type. >>> >>> A fix for this would be to check that the value is not null >>> before checking its type (in Zend/Validate/NotEmpty.php on line >>> 56) >>> >>> if (null !== $value && !is_string($value) && !is_int($value) && >>> !is_float($value) && !is_bool($value) && >>> !is_array($value)) { >>> $this->_error(self::INVALID); >>> return false; >>> } >>> >>> Could someone confirm this issue? >>> >>> Martin Carpentier >>> >>> >>> >>> >>
