1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-03 21:15:42 +02:00

Merge pull request from rxu/ticket/16840-master

[ticket/16840] Add more PHP 8.x builds to tests matrix
This commit is contained in:
Marc Alexander 2021-08-16 23:07:14 +02:00
commit daeca1f684
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
4 changed files with 35 additions and 15 deletions
.github
phpBB/phpbb/db/driver
tests/test_framework

@ -28,18 +28,12 @@ NGINX_PHP_CONF="$DIR/nginx-php.conf"
PHP_FPM_BIN="/usr/sbin/php-fpm$PHP_VERSION"
PHP_FPM_CONF="$DIR/php-fpm.conf"
if [ "$PHP_VERSION" == '8.1' ]
if [ ! -f $PHP_FPM_BIN ] && [ -f "/usr/bin/php-fpm" ]
then
if [ -f "/usr/sbin/php-fpm8.0" ]
then
PHP_FPM_BIN="/usr/sbin/php-fpm8.0"
elif [ ! -f $PHP_FPM_BIN ] && [ -f "/usr/bin/php-fpm" ]
then
PHP_FPM_BIN="/usr/bin/php-fpm"
fi
PHP_FPM_BIN="/usr/bin/php-fpm"
fi
if [ ! -f $PHP_FPM_BIN ] && [ "$PHP_VERSION" != '8.1' ]
if [ ! -f $PHP_FPM_BIN ]
then
sudo apt-get install php$PHP_VERSION-fpm php$PHP_VERSION-cli \
php$PHP_VERSION-curl php$PHP_VERSION-xml php$PHP_VERSION-mbstring \

@ -128,8 +128,8 @@ jobs:
db: "mysql:8.0"
- php: '8.0'
db: "mysql:5.7"
#- php: '8.1'
# db: "mysql:5.7"
- php: '8.1'
db: "mysql:5.7"
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
@ -448,6 +448,10 @@ jobs:
include:
- php: '7.4'
db: "postgres"
- php: '8.0'
db: "postgres"
- php: '8.1'
db: "postgres"
name: Windows - PHP ${{ matrix.php }} - ${{ matrix.db }}

@ -207,14 +207,16 @@ class postgres extends \phpbb\db\driver\driver
return false;
}
$safe_query_id = $this->clean_query_id($this->query_result);
if ($cache && $cache_ttl)
{
$this->open_queries[(int) $this->query_result] = $this->query_result;
$this->open_queries[$safe_query_id] = $this->query_result;
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
}
else if (strpos($query, 'SELECT') === 0)
{
$this->open_queries[(int) $this->query_result] = $this->query_result;
$this->open_queries[$safe_query_id] = $this->query_result;
}
}
else if ($this->debug_sql_explain)
@ -555,6 +557,15 @@ class postgres extends \phpbb\db\driver\driver
*/
private function clean_query_id($query_id)
{
return is_resource($query_id) ? (int) $query_id : $query_id;
// As of PHP 8.1 PgSQL functions accept/return \PgSQL\* objects instead of "pgsql *" resources
// Attempting to cast object to int will throw error, hence correctly handle all cases
if (is_resource($query_id))
{
return function_exists('get_resource_id') ? get_resource_id($query_id) : (int) $query_id;
}
else
{
return is_object($query_id) ? spl_object_id($query_id) : $query_id;
}
}
}

@ -450,7 +450,18 @@ class phpbb_test_case_helpers
// Cache the parser and renderer with a key based on this method's arguments
$cache = new \phpbb\cache\driver\file($cache_dir);
$prefix = '_s9e_' . md5(serialize(func_get_args()));
// Don't serialize unserializable resource/object arguments
// See https://www.php.net/manual/en/function.serialize.php#refsect1-function.serialize-notes
$args = func_get_args();
foreach ($args as $key => $arg)
{
if (is_resource($arg) || (is_object($arg) && (!is_a($arg, 'Serializable') && !method_exists($arg, '__serialize'))))
{
unset($args[$key]);
}
}
$prefix = '_s9e_' . md5(serialize($args));
$cache_key_parser = $prefix . '_parser';
$cache_key_renderer = $prefix . '_renderer';
$container->set('cache.driver', $cache);