Re: QF 3.2 - regex throwing errors

From: Date: Thu, 06 Nov 2003 10:37:02 +0000
Subject: Re: QF 3.2 - regex throwing errors
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8808@lists.php.net to get a copy of this message
Hi! Mike Carter wrote:
Thanks, that gets the asteriks back, but I can't find a happy balance. Now my additional regular expression rule causes the PHP warning: Warning: preg_match() expects parameter 2 to be string, array given in /usr/share/pear/HTML/QuickForm/Rule/Regex.php on line 61 The rule is defined: $this->addGroupRule('postcodeGroup', array('postcode' => array( array($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') ))); I've also tried defining the rule as you did with the 'required' rule above, $form->addGroupRule('postcodeGroup', 'Postcode is required', 'regex', '/[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}/', 1, 'client'); Both ways cause the same PHP warning and fail to let me proceed when submitting the form.
Cannot reproduce this here, the rule works OK. If you can give a self-contained example to reproduce the problem, please do so. I also see that you use a subclass of HTML_QuickForm. Is it possible that you changed anything validation-related in it and thus the rule breaks?

« previous php.pear.general (#8808) next »