From 0f4a0275b587ff7e307ba68e415cd19b857401d5 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 29 Sep 2019 17:58:56 +0100 Subject: [PATCH] use is_int instead of is_numeric if we want to reject numeric strings, should fix #681 --- core/database.php | 2 +- core/imageboard/image.php | 6 +++--- core/polyfills.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/database.php b/core/database.php index 3bead690..bc002bcb 100644 --- a/core/database.php +++ b/core/database.php @@ -213,7 +213,7 @@ class Database // $stmt = $this->db->prepare($query); if (!array_key_exists(0, $args)) { foreach ($args as $name=>$value) { - if (is_numeric($value)) { + if (is_int($value)) { $stmt->bindValue(':'.$name, $value, PDO::PARAM_INT); } else { $stmt->bindValue(':'.$name, $value, PDO::PARAM_STR); diff --git a/core/imageboard/image.php b/core/imageboard/image.php index 33804a60..c757e334 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -81,9 +81,9 @@ class Image } $this->locked = bool_escape($this->locked); - assert(is_numeric($this->id)); - assert(is_numeric($this->height)); - assert(is_numeric($this->width)); + assert(is_int($this->id)); + assert(is_int($this->height)); + assert(is_int($this->width)); } } diff --git a/core/polyfills.php b/core/polyfills.php index c39ec13a..4f0b2c71 100644 --- a/core/polyfills.php +++ b/core/polyfills.php @@ -503,7 +503,7 @@ function bool_escape($input): bool */ if (is_bool($input)) { return $input; - } elseif (is_numeric($input)) { + } elseif (is_int($input)) { return ($input === 1); } else { $value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);