Issue Details (XML | Word | Printable)

Key: ZF-1912
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Alexander Veremyev
Reporter: Laurent Melmoux
Votes: 3
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Message concurrency between options notEmptyMessage and Zend_Validate_Alpha::STRING_EMPTY

Created: 06/Sep/07 04:52 AM   Updated: 18/Jun/09 03:03 AM   Resolved: 22/May/09 08:13 AM
Return to search "Fixed in 1.5.1"
Component/s: Zend_Filter_Input
Affects Version/s: None
Fix Version/s: 1.8.2

Time Tracking:
Original Estimate: 1 day
Original Estimate - 1 day
Remaining Estimate: 1 day
Remaining Estimate - 1 day
Time Spent: Not Specified
Time Spent - Not Specified

Issue Links:
Dependency
 

Fix Version Priority: Nice to Have


 Description  « Hide

I'm not sure if it's the correct behavior or not but if you set notEmptyMessage in the options array and you use a validation rule which handle empty message like Zend_Validate_Alpha the "generic" message notEmptyMessage will not be use in favor of which handle Zend_Validate_Alpha::STRING_EMPTY.

By setting notEmptyMessage in the options I was expecting to have the same message for all empty value.

$data = array('title'=>'');

$validators = array(
    'title' => array('Alpha', 'presence' => 'required')
);

$options = array(
    'missingMessage'  => "Le champ '%field%' est manquant",
    'notEmptyMessage' => "Le champ '%field%' est requis"
);

$input = new Zend_Filter_Input(null, $validators, $data, $options);

print_r($input->getMessages());
// Output
// Array ( [title] => Array ( [0] => '' is an empty string ) )


Bill Karwin added a comment - 17/Oct/07 03:28 PM

Changing to 'Unassigned'


Wil Sinclair added a comment - 21/Mar/08 05:05 PM

This issue should have been fixed for the 1.5 release.


Wil Sinclair added a comment - 18/Apr/08 01:11 PM

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.


Wil Sinclair added a comment - 18/Apr/08 04:58 PM

Please evaluate and categorize/assign as necessary.


Wil Sinclair added a comment - 26/Jan/09 10:50 AM

Please evaluate and close this issue as appropriate.


Alexander Veremyev added a comment - 18/May/09 06:15 AM - edited

There are actually a set of additional issues:

  • Zend_Filter_Input skips ALLOW_EMPTY metacommand processing if any validator is applied to the field - ZF-6708;
  • Zend_Filter_Input doesn't process messages -> validators mapping correctly - ZF-6709.
  • Zend_Filter_Input skips ALLOW_EMPTY metacommand processing if rule refers several fields - ZF-6711
  • Zend_Filter_Input skips validators processing if ALLOW_EMPTY metacommand is set to true - ZF-6713

Alexander Veremyev added a comment - 22/May/09 08:13 AM

Fixed.

ALLOW_EMPTY overrides other validators processing now. The same behavior is described in the documentation.

Empty fields are never processed by rule validators.
If field is empty and it's allowed, then other validators processing is skipped.
If field is empty and it's not allowed, then corresponding message is set.