Migrating from previous versions
The API of Zend_Validate has changed from time
to time. If you started to use Zend_Validate and its subcomponents
in earlier versions follow the guidelines below to migrate your scripts to
use the new API.
Migrating from 1.9 to 1.10 or newer
Self written adapters
When setting returning a error from within a self written validator you have to
call the _error() method. Before Zend Framework 1.10 you
were able to call this method without giving a parameter. It used then the first
found message template.
This behaviour is problematic when you have validators with more than one different
message to be returned. Also when you extend an existing validator you can get
unexpected results. This could lead to the problem that your user get not the
message you expected.
_error(); // unexpected results between different OS
...
}
}
]]>
To prevent this problem the _error() method is no longer
allowed to be called without giving a parameter.
_error(self::MY_ERROR); // defined error, no unexpected results
...
}
}
]]>
Simplification in date validator
Before Zend Framework 1.10 2 identical messages were thrown within the date
validator. These were NOT_YYYY_MM_DD and
FALSEFORMAT. As of Zend Framework 1.10 only the
FALSEFORMAT message will be returned when the given date
does not match the set format.
Fixes in Alpha, Alnum and Barcode validator
Before Zend Framework 1.10 the messages within the 2 barcode adapters, the Alpha
and the Alnum validator were identical. This introduced problems when using custom
messages, translations or multiple instances of these validators.
As with Zend Framework 1.10 the values of the constants were changed to
be unique. When you used the constants as proposed in the manual there is
no change for you. But when you used the content of the constants in your code
then you will have to change them. The following table shows you the changed values:
Available Validation Messages
Validator
Constant
Value
Alnum
STRING_EMPTY
alnumStringEmpty
Alpha
STRING_EMPTY
alphaStringEmpty
Barcode_Ean13
INVALID
ean13Invalid
Barcode_Ean13
INVALID_LENGTH
ean13InvalidLength
Barcode_UpcA
INVALID
upcaInvalid
Barcode_UpcA
INVALID_LENGTH
upcaInvalidLength
Digits
STRING_EMPTY
digitsStringEmpty