From 19c4fcaf34d00adde79630a89e01307fee55c5b4 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 30 Sep 2019 10:40:15 +0100 Subject: [PATCH] even with EMULATE_PREPARES=false, sqlite still returns strings for int columns... --- core/database.php | 1 - core/imageboard/image.php | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/database.php b/core/database.php index a38dd178..5a5a40cb 100644 --- a/core/database.php +++ b/core/database.php @@ -87,7 +87,6 @@ class Database $db_params = [ PDO::ATTR_PERSISTENT => $ka, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_EMULATE_PREPARES => false, # return native types ]; $this->db = new PDO(DATABASE_DSN, $db_user, $db_pass, $db_params); diff --git a/core/imageboard/image.php b/core/imageboard/image.php index c757e334..4ad9ae75 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -81,9 +81,13 @@ class Image } $this->locked = bool_escape($this->locked); - assert(is_int($this->id)); - assert(is_int($this->height)); - assert(is_int($this->width)); + assert(is_numeric($this->id)); + assert(is_numeric($this->height)); + assert(is_numeric($this->width)); + + $this->id = int_escape($this->id); + $this->height = int_escape($this->height); + $this->width = int_escape($this->width); } }