Avoid passing non-string args to `ctype_*()` functions

This commit is contained in:
Johannes Meyer 2022-01-14 11:24:20 +01:00 committed by Thomas Gelf
parent 2712275c45
commit 420dfcbdbf
2 changed files with 3 additions and 3 deletions

View File

@ -8,11 +8,11 @@ class FilterInt implements ValueFilter
{
public function filter($value)
{
if ($value === '') {
if ($value === '' || $value === null) {
return null;
}
if (! ctype_digit($value)) {
if (is_string($value) && ! ctype_digit($value)) {
return $value;
}

View File

@ -473,7 +473,7 @@ abstract class QuickTable implements Paginatable, ValidHtml
protected function valueToTimestamp($value)
{
// We consider integers as valid timestamps. Does not work for URL params
if (ctype_digit($value)) {
if (! is_string($value) || ctype_digit($value)) {
return $value;
}
$value = strtotime($value);