1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 04:30:29 +01:00

[ticket/16840] Add PHP 8.0 / 8.1 builds for Windows tests

Also fix Postrges PHP 8.1 related issue.

PHPBB3-16840
This commit is contained in:
rxu 2021-08-07 11:21:44 +07:00
parent b01a956461
commit 721a39502a
No known key found for this signature in database
GPG Key ID: 955F0567380E586A
2 changed files with 20 additions and 3 deletions

View File

@ -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 }}
@ -519,6 +523,8 @@ jobs:
Set-ACL -Path "${env:TEMP_DIR}" -ACLObject $acl
cd ${env:GITHUB_WORKSPACE}\phpBB
php ..\composer.phar install
php ..\composer.phar remove phpunit/dbunit --dev --update-with-dependencies
php ..\composer.phar require symfony/yaml:~4.4 misantron/dbunit:~5.0 phpunit/phpunit:^9.3 --dev --update-with-all-dependencies --ignore-platform-reqs
cd ..
- name: Setup database
run: |

View File

@ -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;
}
}
}