ZF-6623: Min and Max swapped in Zend_Validate_StringLength when building a form from a Zend_Config

Issue Type: Bug Created: 2009-05-12T09:21:42.000+0000 Last Updated: 2010-08-03T11:14:45.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Richard Fisher (richard.fisher) Assignee: Thomas Weidner (thomas) Tags: - Zend_Form

  • Zend_Validate

Related issues: - ZF-5847



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"


Posted by Thomas Weidner (thomas) on 2009-05-12T12:23:20.000+0000

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

Posted by Thomas Weidner (thomas) on 2009-09-10T04:33:07.000+0000

Feature implemented with r18058.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.