diff options
author | sapics <gv.nishino@gmail.com> | 2021-01-16 08:10:57 +0100 |
---|---|---|
committer | sapics <gv.nishino@gmail.com> | 2021-01-16 08:10:57 +0100 |
commit | 624ddad97028087ee4d61ab90827b944a192f65e (patch) | |
tree | 0f9a7790abdb02bb42cb6fb29757185734a1bc43 /system/database/drivers/pdo/pdo_driver.php | |
parent | af8cbdeed7b43951301e906bf73cabd948a9299a (diff) |
Fix error in pdo/pgsql for php8.0
From PHP8.0, default PDO::ATTR_ERRMODE is changed
from PDO::ERRMODE_SILENT to PDO::ERRMODE_EXCEPTION.
Reference: https://wiki.php.net/rfc/pdo_default_errmode
Diffstat (limited to 'system/database/drivers/pdo/pdo_driver.php')
-rw-r--r-- | system/database/drivers/pdo/pdo_driver.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index d0a2bf959..b2178b684 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -131,6 +131,14 @@ class CI_DB_pdo_driver extends CI_DB { $this->options[PDO::ATTR_PERSISTENT] = TRUE; } + // From PHP8.0, default PDO::ATTR_ERRMODE is changed + // from PDO::ERRMODE_SILENT to PDO::ERRMODE_EXCEPTION + // as https://wiki.php.net/rfc/pdo_default_errmode + if ( ! isset($this->options[PDO::ATTR_ERRMODE])) + { + $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; + } + try { return new PDO($this->dsn, $this->username, $this->password, $this->options); |