Zend Framework

Error Messages not diplaying in IsImage Validator

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor 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

Activity

Hide
Marco Kaiser added a comment - - edited

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...)

Show
Marco Kaiser added a comment - - edited 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...)
Hide
Thomas Weidner added a comment -

Fixed with r18659

Show
Thomas Weidner added a comment - Fixed with r18659

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: