Hello,
I would like to use regular expression to validate a field, so I put my regex string into "regular expression" field. Problem is the validation doesn't work and this is the result of my investigation.
In the file /cegcore2/admin/extensions/chronofc/functions/validate_fields_output.php the parameter from the "regular expression" is empty. Starting line 69 this is the code that extracts the regexp parameter to fill $vfnParam. But for that the rule should contain a bracket (this is tested line76) but in my case the rule = "regExp" without any brackets.
So on the following lines (starting line 89) we call the validate.php file with "regex" but without the string to be compared with since we don't pass $vfnParam
Regular expression validation is always wrong so.
Do you confirm such bug or can you explain me where I am wrong ?
Best Regards,
Bruno.
I would like to use regular expression to validate a field, so I put my regex string into "regular expression" field. Problem is the validation doesn't work and this is the result of my investigation.
In the file /cegcore2/admin/extensions/chronofc/functions/validate_fields_output.php the parameter from the "regular expression" is empty. Starting line 69 this is the code that extracts the regexp parameter to fill $vfnParam. But for that the rule should contain a bracket (this is tested line76) but in my case the rule = "regExp" without any brackets.
$fview['validation'] = array_filter($fview['validation']); if(!empty($fview['validation'])){ foreach($fview['validation'] as $rule => $ruledata){ $vfn = $rule; $vfnParam = null; if(strpos($vfn, '[') !== false){ $vfnps = explode('[', $vfn, 2); $vfn = $vfnps[0]; $vfnParam = rtrim($vfnps[1], ']'); }
So on the following lines (starting line 89) we call the validate.php file with "regex" but without the string to be compared with since we don't pass $vfnParam
Regular expression validation is always wrong so.
if(!is_null($vfnParam)){ if(in_array($vfn, ['match', 'different'])){ $vfnParam = \G2\L\Arr::getVal($data, $vfnParam); } $condition = (bool)$validator::$vfn(\G2\L\Arr::getVal($data, $fname), $vfnParam); }else{ $condition = (bool)$validator::$vfn(\G2\L\Arr::getVal($data, $fname)); }
Do you confirm such bug or can you explain me where I am wrong ?
Best Regards,
Bruno.