Zend Framework

Min and Max swapped in Zend_Validate_StringLength when building a form from a Zend_Config

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.1
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Form, Zend_Validate
  • Labels:
    None

Description

Creating a form via a Zend_Config...

(snippet)
events.event1.accept.elements.firstName.type = "text"
events.event1.accept.elements.firstName.options.label = "First Name"
events.event1.accept.elements.firstName.required = true
events.event1.accept.elements.firstName.options.validators.strlen.validator = "StringLength"
events.event1.accept.elements.firstName.options.validators.strlen.options.max = "35"
events.event1.accept.elements.firstName.options.validators.strlen.options.min = "1"
(end snippet)

max and min are swapped in the resulting validator - verified by dumping the object.

With the values above, an exception is thrown complaining "The maximum must be greater than or equal to the minimum length, but 1 < 35"

Issue Links

Activity

Hide
Thomas Weidner added a comment -

As note:
The problem is that StringLength defines min as first parameter and max as second.

So to have a quick workaround you should switch min and max in your ini file to get it working.
For the future we already have a solution which should be ready for 1.9

Show
Thomas Weidner added a comment - As note: The problem is that StringLength defines min as first parameter and max as second. So to have a quick workaround you should switch min and max in your ini file to get it working. For the future we already have a solution which should be ready for 1.9
Hide
Thomas Weidner added a comment -

Feature implemented with r18058.

Show
Thomas Weidner added a comment - Feature implemented with r18058.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: