ZF-8879: Zend_Validate_PostCode throwing Exception when empty value specified on required field using Zend_Form

Description

When using Zend_Validate_Postcode with Zend_Form an exception is thrown when an empty value is passed to a required field.

Reproduce Code:

// Form Element $postcode = $this->createElement('text','ZIP'); $postcode->setLabel('Post Code') ->addFilter('StringTrim') ->setRequired(true) ->addValidator('PostCode', false);

// Controller if ($form->isValid($_POST) { etc...

Expected result: Form returned failing validation with 'Value is required and cannot be empty'

Actual Result:

Exception thrown with message: Format has to be a not empty string

Comments

Having looked at the source, I can see this is because I have no default Locale in the registry of my application, and am not passing over any configuration to the validator - maybe the exception message should be altered slightly to clarify what this issue is?