-- Andrei Iarus <[email protected]> wrote
(on Thursday, 02 April 2009, 09:47 AM -0700):
> Hello,
>
> After deploying ZF 1.7.8 (Minimal), and creating a form with a Form Element of
> Regex type, I get the following error:
> Fatal error: Cannot unset string offsets in
> C:\wamp\www\my-project\library\Zend
> \Form\Element.php on line 2004
> I use this:
>
>
> $email = $this->addElement('text', 'email', array(
>
> 'filters' => array('StringTrim'),
>
> 'validators' => array(
>
> array('Regex', false, ".*"),
This is incorrectly created, for two reasons. First, the third argument
should be an array of arguments, and second, the regex you provide does
not have boundaries. (And, third, ".*" will match anything and nothing,
but it appears you're aware of that.)
array('Regex', false, array('/.*/'))
will work better.
>
> array('StringLength', false, array(5, 255)),
>
> ),
>
> 'required' => true,
>
> 'label' => 'Email Address *',
> ));
>
> Of course I wanted to use in the Regex Pattern a specific one, but just
> testing
> this simple example, it died.
>
> Is this a bug in ZF? Did someone else noticed the same problem?
--
Matthew Weier O'Phinney
Software Architect | [email protected]
Zend Framework | http://framework.zend.com/