aboutsummaryrefslogtreecommitdiff
path: root/app/Models/DatabaseDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-06-06 09:56:27 +0200
committerGravatar GitHub <noreply@github.com> 2025-06-06 09:56:27 +0200
commitf620f16e2b62cc12e8b2a155d8f764dd8bafefe8 (patch)
tree0fdfb5bad689dc061ef1f74367e75ff46038044f /app/Models/DatabaseDAO.php
parent4de7d0b81310c788365fd3d2ab28dfbbccb5b171 (diff)
Install: add test PDO typing (#7651)
fix https://github.com/FreshRSS/FreshRSS/issues/7647
Diffstat (limited to 'app/Models/DatabaseDAO.php')
-rw-r--r--app/Models/DatabaseDAO.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php
index fe922cb82..0062c23e8 100644
--- a/app/Models/DatabaseDAO.php
+++ b/app/Models/DatabaseDAO.php
@@ -222,6 +222,18 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo {
return str_contains($this->version(), 'MariaDB');
}
+ /**
+ * @return bool true if the database PDO driver returns typed integer values as it should, false otherwise.
+ */
+ final public function testTyping(): bool {
+ $sql = 'SELECT 2 + 3';
+ if (($stm = $this->pdo->query($sql)) !== false) {
+ $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
+ return ($res[0] ?? null) === 5;
+ }
+ return false;
+ }
+
public function size(bool $all = false): int {
$db = FreshRSS_Context::systemConf()->db;