Issues

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

Issue Type: Bug Created: 2010-01-09T14:27:33.000+0000 Last Updated: 2010-03-16T04:23:24.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Christoph, René Pardon (renepardon) Assignee: Rob Allen (rob) Tags: - Zend_Config

  • Zend_Form

Related issues: Attachments:

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:

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

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

initialize config and create form object:

<pre class="highlight">$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

Posted by Christoph, René Pardon (renepardon) on 2010-01-09T14:30:55.000+0000

see at the edit section

Posted by Christian Albrecht (alab) on 2010-03-16T01:53:48.000+0000

This works with 1.10.2, Not an Issue any longer.

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts