Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.9.4
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Validate
-
Labels:None
Description
Zend_Validate_File_IsImage is relying on the isValid method from Zend_Validate_File_MimeType which refers to its own error constants.
As such because IsImage has different constant values it fals to pull through the correct error messages
changing
const FALSE_TYPE = 'fileIsImageFalseType';
const NOT_DETECTED = 'fileIsImageNotDetected';
const NOT_READABLE = 'fileIsImageNotReadable';
to
const FALSE_TYPE = 'fileMimeTypeFalse';
const NOT_DETECTED = 'fileMimeTypeNotDetected';
const NOT_READABLE = 'fileMimeTypeNotReadable';
Resolves
Issue Links
| This issue is related to: | ||||
| ZF-8598 | Zend_Validate_File_IsImage class constant inheritance issue |
|
|
|
I reproduced this bug. The problem is a late static binding problem because the isValid method depends on self::<CONSTANT_NAME> this results in the wrong
identifier and the unknown or not found messageTemplate String.
Solutions:
1. replace self::<CONSTANT_NAME> with constant(get_class($this) . '<CONSTANT_NAME>')
2. remove from the class the own identifiers.
i preferr the 1 solution because the same behavior hits the other classes too. (ImageSize...)