Merge pull request #1734 from PrivateBin/php85

Enable PHP 8.5 testing and handle deprecations
This commit is contained in:
El RIDO 2025-12-03 19:10:03 +01:00 committed by GitHub
commit 52c0846dad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 5 deletions

View file

@ -84,8 +84,13 @@ class Database extends AbstractData
);
// MySQL uses backticks to quote identifiers by default,
// tell it to expect ANSI SQL double quotes
if ($this->_type === 'mysql' && defined('PDO::MYSQL_ATTR_INIT_COMMAND')) {
$options['opt'][PDO::MYSQL_ATTR_INIT_COMMAND] = "SET SESSION sql_mode='ANSI_QUOTES'";
if ($this->_type === 'mysql') {
// deprecated as of PHP 8.5
if (version_compare(PHP_VERSION, '8.5') < 0 && defined('PDO::MYSQL_ATTR_INIT_COMMAND')) {
$options['opt'][PDO::MYSQL_ATTR_INIT_COMMAND] = "SET SESSION sql_mode='ANSI_QUOTES'";
} elseif (defined('Pdo\Mysql::ATTR_INIT_COMMAND')) {
$options['opt'][Pdo\Mysql::ATTR_INIT_COMMAND] = "SET SESSION sql_mode='ANSI_QUOTES'";
}
}
$tableQuery = $this->_getTableQuery($this->_type);
$this->_db = new PDO(