Appendix B. Zend Framework Migration Notes

Table of Contents

B.1. Zend Framework 1.10
B.1.1. Zend_File_Transfer
B.1.1.1. Count validation
B.1.1.2. MimeType validation
B.1.2. Zend_Validate
B.1.2.1. Self written validators
B.1.2.2. Simplification in date validator
B.1.2.3. Fixes in Alpha, Alnum and Barcode validator
B.2. Zend Framework 1.9
B.2.1. Zend_Filter
B.2.2. Zend_Http_Client
B.2.2.1. Changes to internal uploaded file information storage
B.2.2.2. Deprecation of Zend_Http_Client::_getParametersRecursive()
B.2.3. Zend_Locale
B.2.3.1. Depreciated methods
B.2.4. Zend_View_Helper_Navigation
B.3. Zend Framework 1.8
B.3.1. Zend_Controller
B.3.1.1. Standard Route Changes
B.3.2. Zend_Locale
B.3.2.1. Default caching
B.4. Zend Framework 1.7
B.4.1. Zend_Controller
B.4.1.1. Dispatcher Interface Changes
B.4.2. Zend_File_Transfer
B.4.2.1. Changes when using filters and validators
B.4.2.1.1. Filter: Rename
B.4.2.1.2. Validator: Count
B.4.2.1.3. Validator:Extension
B.4.2.1.4. Validator: FilesSize
B.4.2.1.5. Validator: Hash
B.4.2.1.6. Validator: ImageSize
B.4.2.1.7. Validator: Size
B.4.3. Zend_Locale
B.4.3.1. Changes when using isLocale()
B.4.3.2. Changes when using getDefault()
B.4.4. Zend_Translate
B.4.4.1. Setting languages
B.4.5. Zend_View
B.4.5.1. Disabling LFI protection for the render() method
B.5. Zend Framework 1.6
B.5.1. Zend_Controller
B.5.1.1. Dispatcher Interface Changes
B.5.2. Zend_File_Transfer
B.5.2.1. Changes when using validators
B.6. Zend Framework 1.5
B.6.1. Zend_Controller
B.7. Zend Framework 1.0
B.7.1. Zend_Controller
B.7.2. Zend_Currency
B.8. Zend Framework 0.9
B.8.1. Zend_Controller
B.9. Zend Framework 0.8
B.9.1. Zend_Controller
B.10. Zend Framework 0.6
B.10.1. Zend_Controller

B.1. Zend Framework 1.10

When upgrading from a previous release to Zend Framework 1.10 or higher you should note the following migration notes.

B.1.1. Zend_File_Transfer

B.1.1.1. Count validation

Before release 1.10 the MimeType validator used a wrong naming. For consistency the following constants have been changed:

Table B.1. 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.

B.1.1.2. 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.

[Note] 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.

Example B.1. Allow the usage of the HTTP fields

// at initiation
$valid = new Zend_File_Transfer_Adapter_Http(array('headerCheck' => true);

// or afterwards
$valid->enableHeaderCheck();

B.1.2. Zend_Validate

B.1.2.1. 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.

My_Validator extends Zend_Validate_Abstract
{
    public isValid($value)
    {
        ...
        $this->_error(); // unexpected results between different OS
        ...
    }
}

To prevent this problem the _error() method is no longer allowed to be called without giving a parameter.

My_Validator extends Zend_Validate_Abstract
{
    public isValid($value)
    {
        ...
        $this->_error(self::MY_ERROR); // defined error, no unexpected results
        ...
    }
}

B.1.2.2. 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.

B.1.2.3. 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:

Table B.2. 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