From b8259da880e6c4192545e4b20316c3dd6412015b Mon Sep 17 00:00:00 2001 From: Nicolas Abram Date: Sun, 30 Mar 2025 23:55:26 -0300 Subject: [PATCH] Set PDO::ERRMODE_SILENT for newer versions Since the default changed to PDO::ERRMODE_EXCEPTION --- classes/Database.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/classes/Database.php b/classes/Database.php index 0b663a5..23d81c1 100644 --- a/classes/Database.php +++ b/classes/Database.php @@ -36,6 +36,11 @@ public function __construct($data) $this->db = new PDO("sqlite:".$this->data['path']); if($this->db!=NULL) { + if (version_compare(phpversion(), '8.0', '>=')) { + // Prior to PHP 8.0 this was the default, and we rely on it for error reporting + // See https://www.php.net/manual/en/pdo.error-handling.php + $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); + } $this->type = "PDO"; break; }