Zend Framework 1.10 When upgrading from a previous release to Zend Framework 1.10 or higher you should note the following migration notes. Zend_File_Transfer Count validation Before release 1.10 the MimeType validator used a wrong naming. For consistency the following constants have been changed: Changed Validation Messages Old New Value TOO_MUCH TOO_MANY Too many files, maximum '%max%' are allowed but '%count%' are given TOO_LESS TOO_FEW Too few files, minimum '%min%' are expected but '%count%' are given
When you are translating these messages within your code then use the new constants. As benefit you don't need to translate the original string anymore to get a correct spelling.
MimeType validation For security reasons we had to turn off the default fallback mechanism of the MimeType, ExcludeMimeType, IsCompressed and IsImage validators. This means, that if the fileInfo or magicMime extensions can not be found, the validation will always fail. If you are in need of validation by using the HTTP fields which are provided by the user then you can turn on this feature by using the enableHeaderCheck() method. Security hint You should note that relying on the HTTP fields, which are provided by your user, is a security risk. They can easily be changed and could allow your user to provide a malcious file. Allow the usage of the HTTP fields true); // or afterwards $valid->enableHeaderCheck(); ]]>
Zend_Validate Self written validators 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