In an old version of the docebo cms There is a check with preg_match(), which however generates error and returns false, Obviously there is something that does not go in the pattern But probably with an older PHP version it worked Does anyone know where the mistake is, And how would it be corrected?
$str="my_session";
clean_input_keys($str);
protected function clean_input_keys($str) {
$pattern = '#^[&a-zA-Z0-9\.:_/-\s]+$#uD';
$b_preg_match = preg_match($pattern, $str);
var_dump($b_preg_match); //false //preg_match() returns FALSE if an error occurred.
if ( ! $b_preg_match) {
exit('Disallowed key characters in global data.');
}
return $str;
}
/-\sdoesn't seem to be valid. I would suggest/\s-instead.