ZF-8762: Zend_Form creates wrong regex pattern when using .xml as form configuration

Description

Hi,

when you try to use one regex pattern to validate a form element you'll get the following error: {quote}Exception information:

Message: Internal error matching pattern 'Array' against value 'test' Stack trace:

0 /home/test/Zend/Framework/ZendFramework-1.10.0alpha1/library/Zend/Controller/Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

1 /home/test/Zend/Framework/ZendFramework-1.10.0alpha1/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()

2 /home/test/Zend/Framework/ZendFramework-1.10.0alpha1/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()

3 /var/www/test.de/public/index.php(16): Zend_Application->run()

4 {main}

Request Parameters:

array ( 'module' => 'default', 'controller' => 'auth', 'action' => 'signup', 'csrf' => '109e6aec85ffbcc4b67d987346c066f5', 'username' => '', 'password' => 'test', 'mail' => '', 'submit' => 'submit', ) {quote}

system information: zf 1.10.0alpha1 PHP PHP 5.2.10-2ubuntu6.3 with Suhosin-Patch 0.9.7

used configuration:

<?xml version="1.0" encoding="utf-8"?>

  signupyela-mod-formposthashuniquetextusername:
            StringLength420truepasswordPassword:
            Regex/^[-a-z0-9_]+/iStringLength320truetextmail
            EmailAddresstruesubmitSubmit

initialize config and create form object:

$formConfig = new Zend_Config_Xml(APPLICATION_PATH . '/resources/forms/signup.xml');
$form = new Zend_Form($formConfig->user->signup);

this would work properly: $form->getElement('password')->addValidator('Regex', false, array('/^[-a-z0-9_]+/i'));

edit: the regex validator gets an array passed and then it call $this->setPattern($pattern); in the method it just do: $this->_pattern = (string) $pattern; so the pattern is "Array"

Comments

see at the edit section

This works with 1.10.2, Not an Issue any longer.