diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 30915156..64767946 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,11 +27,11 @@ jobs: continue-on-error: "${{ matrix.experimental }}" strategy: matrix: - php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] experimental: [false] # uncomment this to start testing on development release # include: -# - php-versions: '8.5' # development release, things can break +# - php-versions: '8.6' # development release, things can break # experimental: true env: extensions: gd, sqlite3 diff --git a/lib/Data/Database.php b/lib/Data/Database.php index a574c13a..61c6ec77 100644 --- a/lib/Data/Database.php +++ b/lib/Data/Database.php @@ -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( diff --git a/tst/ControllerTest.php b/tst/ControllerTest.php index 41aad6e9..db6b6ccb 100644 --- a/tst/ControllerTest.php +++ b/tst/ControllerTest.php @@ -155,7 +155,12 @@ class ControllerTest extends TestCase { $newConfig = new class extends Configuration {}; $configValue = (new ReflectionClass(Controller::class))->getProperty('_conf'); - $configValue->setAccessible(true); + if (version_compare(PHP_VERSION, '8.1') < 0) { + // > This function has been DEPRECATED as of PHP 8.5.0. [...] + // > As of PHP 8.1.0, calling this method has no effect; all properties are accessible by default. + // @see: https://www.php.net/manual/en/reflectionproperty.setaccessible.php + $configValue->setAccessible(true); + } ob_start(); $controller = new Controller($newConfig); ob_end_clean();