RE: [PEAR] QF 3.2 - regex throwing errors
| From: | Mike Carter | Date: | Wed, 05 Nov 2003 17:37:12 +0000 |
| Subject: | RE: [PEAR] QF 3.2 - regex throwing errors | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8781@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
>
> <mikeatwork@ukonline.co.uk> wrote :
>
> > Hi,
> >
> > Just upgraded to QF 3.2 and appear to be getting a regular
> expression
> > error now.
> >
> > I defined a rule to check if a postcode entered was valid:
> >
> > $this->addRule('postcodeGroup',
> $this->language['L_InvalidPostcode'],
> > 'regex', '/[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1}
> {0,1}[0-9][A-Za-z]{2}/',
> > 'client');
>
> Maybe because your postcodeGroup is a group ?
> Send the element declaration so we can check this.
The declaration is as follows:-
$postcode = array();
$postcode[] = &HTML_QuickForm::createElement('text', 'postcode',
'',
array('size' => '25', 'maxlength' => '10',
'tabindex' => 2));
$postcode[] = &HTML_QuickForm::createElement('static', '', '',
str_replace('#helptext#', $this->language['L_HelpPostcode'], $helpButton));
$this->addGroup($postcode, 'postcodeGroup',
$this->language['L_YourPostcode']);
> > When the form is submitted the validation appears to be executed on
> > the server side now (why?) and also kicks up the warning:
>
> Do you really wonder why we enforce server-side validation ? :)
Heh. My query was because, the last time I checked before upgrading to QF
3.2, javascript validation was being executed. Now its not..
> > Warning: preg_match() expects parameter 2 to be string,
> array given in
> > /usr/local/lib/php/HTML/QuickForm/Rule/Regex.php on line 61
>
> > Did something major change? I cannot see anything relevant
> mentioned
> > in the changes for this version.
>
> Please send a test case. Thanks,
A couple of things I didn't mention earlier:
Running PHP 4.3.3, Redhat Linux, Apache 1.3.28
Regards,
Mike C.
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________