Re: Quickform nonzero rule bug (?)

From: Date: Wed, 25 Jun 2003 15:04:26 +0000
Subject: Re: Quickform nonzero rule bug (?)
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17705@lists.php.net to get a copy of this message
<sklar@sklar.com> wrote : > On Wednesday, June 25, 2003 5:22 AM, mailto:jeroen@terena.nl > wrote: > >>>> Anything below 10 won't validate. The rule on line 226 of >>>> Quickform.php is: >>>> >>>> 'nonzero' =>array('regex', >>>> '/^[1-9][0-9]+/'), >>>> >>>> Regex is not my strongest point, can anyone tell me of this looks >>>> right? It looks like it expect two digits.. >>>> >>>> >>> >>> Hi Jeroen, >>> >>> You can probably use this regex instead: /^[1-9][0-9]?/ >>> >>> >> Yep that works better. Any number except 0 will validate. Will you >> change it in CVS? > > I reported this a month ago (http://bugs.php.net/bug.php?id=23762) and it > was fixed and then rolled back. I rolled back because it changed the purpose of the rule which was to validate 2345 and not 02345. I guess it's not very useful and I don't know how it made it into QuickForm in the first place :) I never used this rule myself. Now, if no one objects, I can maybe change it for : /^-?[1-9][0-9]*$/ as you suggested AFAIK. But that's a BC break and it's quite easy to use 'regex' instead. Bertrand Mansion Mamasam

« previous php.pear.dev (#17705) next »