mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-01-06 10:35:31 -05:00
Merge pull request #1734 from PrivateBin/php85
Enable PHP 8.5 testing and handle deprecations
This commit is contained in:
commit
52c0846dad
3 changed files with 15 additions and 5 deletions
4
.github/workflows/tests.yml
vendored
4
.github/workflows/tests.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue