View Full Version : Changed Servers and Getting Error
jwright114936
06-12-2009, 08:16 AM
The forms and validation were working fine. Uploaded to clients new server and now getting these errors.
Warning: eregi() [function.eregi]: REG_BADRPT in /home/phase1/public_html/WA_ValidationToolkit/WAVT_Scripts_PHP.php on line 547
Warning: Cannot modify header information - headers already sent by (output started at /home/phase1/public_html/WA_ValidationToolkit/WAVT_Scripts_PHP.php:547) in /home/phase1/public_html/WA_ValidationToolkit/WAVT_Scripts_PHP.php on line 71
Any ideas?
Jack
Ray Borduin
06-12-2009, 08:20 AM
What version of php is installed on that new server?
The first error is the only significant one... the second is caused by the first.
You need to look at: WAVT_Scripts_PHP.php on line 547
Then do some debugging around it. It appears it doesn't like the regular expression you are using or the extension is using.
jwright114936
06-12-2009, 09:21 AM
It appears that it was caused by a regular expression used to validate the password. But why would it work on one server and not the other? It's using PHP Version 5.2.9
Ray Borduin
06-12-2009, 09:38 AM
I'm not sure. Somehow the regular expression engine must be different on the two servers.
jwright114936
06-12-2009, 09:39 AM
Ray,
Tech Support from the server changed a line in a function in WAVT_Scripts_PHP.php to escape the ? from the regular expression. Does this make sense to you?
function WAValidateRX($value,$regExStr,$required,$number) {
$value = $value;
$WAFV_ErrorMessage = "";
$isValid = true;
$regExStr = str_replace(""", '"', $regExStr);
$extraArgs = substr($regExStr,strrpos($regExStr,"/")+1);
$regExStrStripped = substr($regExStr,strpos($regExStr,"/")+1,strrpos($regExStr,"/")-strpos($regExStr,"/")-1);
if (!(!$required && $value=="")) {
if (strpos($extraArgs,"i") >= 0) {
$regExStrStripped=str_replace('?','\?',$regExStrSt ripped); // FIX FOR BROKEN REGEX - Hostgator
$theMatch = eregi($regExStrStripped, $value);
}
else {
$theMatch = ereg($regExStrStripped, $value);
}
if (!$theMatch) {
$theMatch = preg_match($regExStr, $value);
if (!$theMatch) {
$isValid = false;
}
}
}
if (!$isValid) {
$WAFV_ErrorMessage .= ",".$number;
}
return $WAFV_ErrorMessage;
}
Thanks,
Jack
Ray Borduin
06-12-2009, 10:01 AM
You don't need to update our function... you just need to add a slash to your regular expression. What regular expression were you using?
This solution won't work if you meant to have a ? identifier as an optional character, which is what a ? means in a regular expression.
jwright114936
06-12-2009, 10:51 AM
It seemed odd. The Reg Expression is /^\w*(?=\w*\d)(?=\w*[a-z])\w*$/ I needed it to validate the password for at least 1 number. It worked fine on the other testing servers.
Ray Borduin
06-12-2009, 11:56 AM
Does the fix they recommend work? Or does it break the regular expression? It would appear to me that it actually wouldn't work properly... but I want to verify because I might be missing something.
jwright114936
06-13-2009, 09:08 AM
Yes, it does work, but I would prefer to have the regex work without altering Webassists function.
Ray Borduin
06-15-2009, 07:02 AM
All their code appears to do is add a slash in front of the ?... does it work if you don't update the code and use:
/^\w*(\?=\w*\d)(\?=\w*[a-z])\w*$/
jwright114936
06-17-2009, 10:30 AM
No. It doesn't seem to recognize a number in the password.
Ray Borduin
06-17-2009, 10:36 AM
I guess we might need to make that adjustment in the code. I will log this as a bug to review for a potential update. I guess make the change they suggest since it seems to work.
jwright114936
06-17-2009, 10:44 AM
No. I updated it and it doesn't recognize the number entered in the password. It here another way to validate a password for 7-15 characters with a least 1 number using Validation Toolkit?
Ray Borduin
06-17-2009, 10:54 AM
You could use multiple validations to simplify your regular expression.
Apply entry length validation 7-15 characters
Apply regular expression validation with the pattern: /[0-9]/
That will validate there is at least one number. You can stack validations so that no single validation has to be too complex.
jwright114936
06-17-2009, 11:24 AM
Works great. Thanks again.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.