[Phplib-users] OOHForms and RegEx
Brought to you by:
nhruby,
richardarcher
|
From: Andres B. Z. <aba...@ei...> - 2002-10-11 15:41:54
|
Hello all!
I have been using the PHPLib's OOHForm class with success in a linux redhat
7.2 (apache, mysql & php4) intranet web server. But the same scripts fail
when hosted in the internet. The problem is with the regex support... Most
of the "valid_regex" values do not work. For example: If I try the following
piece of code it works.
$f->add_element(array("type"=>"text",
"name"=>"username",
"minlength"=>4,
"maxlength"=>12,
"length_e"=>"Invalid Username. [ 4 to 12 chars long ]",
"valid_regex"=>"^[a-z]*$",
"valid_e"=>"Invalid Username.",
"value"=>"$username"));
But if I change
"valid_regex"=>"^[a-z]*$"
for
"valid_regex"=>"^[a-Z]*$"
I have the answer:
Warning: REG_ERANGE in ..../class/oohforms.inc on line 476
Invalid Username.
Next is the piece of code at line 476 in oohforms.inc
function self_validate($val) {
if (!is_array($val)) $val = array($val);
reset($val);
while (list($k,$v) = each($val)) {
if ($this->length_e && (strlen($v) < $this->minlength))
return $this->length_e;
if ($this->valid_e && (($this->icase &&
!eregi($this->valid_regex,$v)) ||
(!$this->icase &&
!ereg($this->valid_regex,$v)))) // line 476
return $this->valid_e;
}
return false;
}
Any help will be very welcome
I am not a native english speaker so excuse my poor english language
proficiency.
Thanks
Andres
|