From ad1d16063492dade2901c6f979737b5d6f477bda Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:50:55 +0100 Subject: [PATCH 1/4] Woodpecker: Update PHP version --- .woodpecker/.continuous-deployment.yml | 2 +- .woodpecker/.database_checks.yml | 2 +- .woodpecker/.phpunit.yml | 6 +++--- .woodpecker/.releaser.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.woodpecker/.continuous-deployment.yml b/.woodpecker/.continuous-deployment.yml index b1bc2406a1..767fffde3d 100644 --- a/.woodpecker/.continuous-deployment.yml +++ b/.woodpecker/.continuous-deployment.yml @@ -39,7 +39,7 @@ pipeline: branch: [ develop, '*-rc' ] event: push composer_install: - image: friendicaci/php7.4:php7.4.18 + image: friendicaci/php7.4:php7.4.33 commands: - export COMPOSER_HOME=.composer - composer validate diff --git a/.woodpecker/.database_checks.yml b/.woodpecker/.database_checks.yml index 867638264e..04bdeed620 100644 --- a/.woodpecker/.database_checks.yml +++ b/.woodpecker/.database_checks.yml @@ -1,7 +1,7 @@ matrix: include: - PHP_MAJOR_VERSION: 7.4 - PHP_VERSION: 7.4.18 + PHP_VERSION: 7.4.33 branches: exclude: [ stable ] diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index 7cb91eff76..03801439b7 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -1,11 +1,11 @@ matrix: include: - PHP_MAJOR_VERSION: 7.3 - PHP_VERSION: 7.3.28 + PHP_VERSION: 7.3.33 - PHP_MAJOR_VERSION: 7.4 - PHP_VERSION: 7.4.18 + PHP_VERSION: 7.4.33 - PHP_MAJOR_VERSION: 8.0 - PHP_VERSION: 8.0.5 + PHP_VERSION: 8.0.25 pipeline: php-lint: diff --git a/.woodpecker/.releaser.yml b/.woodpecker/.releaser.yml index 043071ddd3..482ea5429d 100644 --- a/.woodpecker/.releaser.yml +++ b/.woodpecker/.releaser.yml @@ -37,7 +37,7 @@ pipeline: branch: stable event: tag composer_install: - image: friendicaci/php7.4:php7.4.18 + image: friendicaci/php7.4:php7.4.33 commands: - export COMPOSER_HOME=.composer - composer validate From 3b03da325925db012d4981fd12ac51b4323d3916 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:53:01 +0100 Subject: [PATCH 2/4] Activate PHP 8.1 Unit-Tests --- .woodpecker/.phpunit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index 03801439b7..bdfcf8097a 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -6,6 +6,8 @@ matrix: PHP_VERSION: 7.4.33 - PHP_MAJOR_VERSION: 8.0 PHP_VERSION: 8.0.25 + - PHP_MAJOR_VERSION: 8.1 + PHP_VERSION: 8.1.12 pipeline: php-lint: From 477bec197750dd27efd57969653d81da32f7a2ed Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 23:16:12 +0100 Subject: [PATCH 3/4] Fix some PHP8.1 issues if possible --- src/App/Page.php | 2 +- src/Core/L10n.php | 6 +++--- src/Util/Network.php | 8 ++++---- src/Util/ReversedFileReader.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/App/Page.php b/src/App/Page.php index a6f46bdd85..0f14d9f6e6 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -130,7 +130,7 @@ class Page implements ArrayAccess * The return value will be casted to boolean if non-boolean was returned. * @since 5.0.0 */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->page[$offset]); } diff --git a/src/Core/L10n.php b/src/Core/L10n.php index 0f879c4948..a74f18fa6b 100644 --- a/src/Core/L10n.php +++ b/src/Core/L10n.php @@ -188,10 +188,10 @@ class L10n { $lang_variable = $server['HTTP_ACCEPT_LANGUAGE'] ?? null; - $acceptedLanguages = preg_split('/,\s*/', $lang_variable); - - if (empty($acceptedLanguages)) { + if (empty($lang_variable)) { $acceptedLanguages = []; + } else { + $acceptedLanguages = preg_split('/,\s*/', $lang_variable); } // Add get as absolute quality accepted language (except this language isn't valid) diff --git a/src/Util/Network.php b/src/Util/Network.php index 508934db2c..5a06a0056e 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -485,11 +485,11 @@ class Network $get('host') . ($port ? ":$port" : ''); - return (strlen($scheme) ? $scheme . ':' : '') . - (strlen($authority) ? '//' . $authority : '') . + return (!empty($scheme) ? $scheme . ':' : '') . + (!empty($authority) ? '//' . $authority : '') . $get('path') . - (strlen($query) ? '?' . $query : '') . - (strlen($fragment) ? '#' . $fragment : ''); + (!empty($query) ? '?' . $query : '') . + (!empty($fragment) ? '#' . $fragment : ''); } /** diff --git a/src/Util/ReversedFileReader.php b/src/Util/ReversedFileReader.php index cda78ad0ab..2ef062152c 100644 --- a/src/Util/ReversedFileReader.php +++ b/src/Util/ReversedFileReader.php @@ -60,7 +60,7 @@ class ReversedFileReader implements \Iterator $this->fh = fopen($filename, 'r'); if (!$this->fh) { // this should use a custom exception. - throw \Exception("Unable to open $filename"); + throw new \Exception("Unable to open $filename"); } $this->filesize = filesize($filename); $this->pos = -1; From 3550257d9ca6d4a9297c791866f68f9bda58c66b Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 10 Nov 2022 00:04:57 +0100 Subject: [PATCH 4/4] Deactivate PHP 8.1 - PHP 7 incompatible change necessary (App\Page.php OffsetGet mixed return) --- .woodpecker/.phpunit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index bdfcf8097a..6ae4669ca1 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -6,8 +6,8 @@ matrix: PHP_VERSION: 7.4.33 - PHP_MAJOR_VERSION: 8.0 PHP_VERSION: 8.0.25 - - PHP_MAJOR_VERSION: 8.1 - PHP_VERSION: 8.1.12 +# - PHP_MAJOR_VERSION: 8.1 +# PHP_VERSION: 8.1.12 pipeline: php-lint: