Filters/Misc

* be a bit more lenient on level inputs
 * fix displaying array of requirements on error
This commit is contained in:
Sarjuuk
2025-10-06 15:50:33 +02:00
parent 704894c1e3
commit 452615a92d
7 changed files with 44 additions and 25 deletions

View File

@@ -452,20 +452,18 @@ abstract class Filter
if (!Util::checkNumeric($val, NUM_CAST_INT))
return false;
foreach ($valid as $k => $v)
if (in_array($val, $valid))
return true;
foreach ($valid as $v)
{
if (gettype($v) != 'array')
continue;
if ($this->checkInput(self::V_RANGE, $v, $val, true))
return true;
unset($valid[$k]);
}
if (in_array($val, $valid))
return true;
break;
case self::V_RANGE:
if (Util::checkNumeric($val, NUM_CAST_INT) && $val >= $valid[0] && $val <= $valid[1])
@@ -486,7 +484,7 @@ abstract class Filter
if (!$recursive)
{
trigger_error('Filter::checkInput - check failed [type: '.$type.' valid: '.((string)$valid).' val: '.((string)$val).']', E_USER_NOTICE);
trigger_error('Filter::checkInput - check failed [type: '.$type.' valid: '.Util::toString($valid).' val: '.((string)$val).']', E_USER_NOTICE);
$this->error = true;
}