ZF-4651: Zend_Form adding filters and validators does not work with full class name anymore

Description

In the manual the text and examples mention that addFilter() and addValidator() also takes the fully qualified class name like Zend_Filter_Alnum or Zend_Validate_Alnum. This does not work any more since 1.6.0 and throws the following fatal error:


Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name Zend_Filter_Alpha was not found in the registry.' in /home/devhost/zfbuch/ZendFramework-1.6.2/library/Zend/Loader/PluginLoader.php:370 Stack trace: #0 /home/devhost/zfbuch/ZendFramework-1.6.2/library/Zend/Form/Element.php(1937): Zend_Loader_PluginLoader->load('Zend_Filter_Alp...') #1 /home/devhost/zfbuch/ZendFramework-1.6.2/library/Zend/Form/Element.php(1613): Zend_Form_Element->_loadFilter(Array) #2 /home/devhost/zfbuch/ZendFramework-1.6.2/library/Zend/Form/Element.php(524): Zend_Form_Element->getFilters() #3 /home/devhost/zfbuch/ZendFramework-1.6.2/library/Zend/Form/Element.php(541): Zend_Form_Element->_filterValue(NULL, NULL) #4 /home/devhost/zfbuch/ZendFramework-1.6.2/library/Zend/Form/Decorator/ViewHelper.php(201): Zend_Form_Element->getValue() #5 /home/devhost/zfbuch/ZendFramework-1.6.2/library/Zend/Form/Decorator/ViewHelper.php(231): Zend_Form_Decorator_ViewHelper->getValue(Object(Zend_Form_Element_Text))

6 /home/devh in

/home/devhost/zfbuch/ZendFramework-1.6.2/library/Zend/Loader/PluginLoader.php

on line 370

The manual needs to be changed here:

http://framework.zend.com/manual/en/… http://framework.zend.com/manual/en/…

See also discussion: http://nabble.com/Problem-with-Zend_Form-and-filte…

Comments

Confimed in current trunk, here is a patch


Index: documentation/manual/en/module_specs/Zend_Form-Elements.xml
===================================================================
--- documentation/manual/en/module_specs/Zend_Form-Elements.xml (Revision 21764)
+++ documentation/manual/en/module_specs/Zend_Form-Elements.xml (Arbeitskopie)
@@ -232,8 +232,7 @@
 
             
-                    providing a filter name - either a short name or fully
-                    qualified class name
+                    providing a short filter name
                 
@@ -246,9 +245,6 @@
 // Concrete filter instance:
 $element->addFilter(new Zend_Filter_Alnum());
 
-// Fully qualified class name:
-$element->addFilter('Zend_Filter_Alnum');
-
 // Short filter name:
 $element->addFilter('Alnum');
 $element->addFilter('alnum');
@@ -368,8 +364,7 @@
 
             
-                    providing a validator name - either a short name or fully
-                    qualified class name
+                    providing a short validator name
                 
@@ -382,9 +377,6 @@
 // Concrete validator instance:
 $element->addValidator(new Zend_Validate_Alnum());
 
-// Fully qualified class name:
-$element->addValidator('Zend_Validate_Alnum');
-
 // Short validator name:
 $element->addValidator('Alnum');
 $element->addValidator('alnum');

Patch applied to trunk and 1.10 release branch