From d56cee00623d99058a7e33916c4b0cb4d7e25194 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:01:11 +0100 Subject: [PATCH 01/19] Trigger CI with no modifications Alternative for: https://github.com/DOMjudge/domjudge/pull/3279 IRC we needed the development branch for PHPCS support for PHP8.4, it might be they backported this already as PHP8.5 is now out so we need to check if they fixed this in a stable build. --- .github/jobs/fix_pipelinecomponents_image.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/jobs/fix_pipelinecomponents_image.sh b/.github/jobs/fix_pipelinecomponents_image.sh index 8723b86f1b..b80c217827 100755 --- a/.github/jobs/fix_pipelinecomponents_image.sh +++ b/.github/jobs/fix_pipelinecomponents_image.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Leave urly to show the currently failing steps +exit 0 + # We can't convert this script to bash as GHA doesn't have bash installed # # The current script doesn't use a piped command so the "benefit" of using From 30f7aa1a0e4307177c11a34b2551324b584bef94 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:17:58 +0100 Subject: [PATCH 02/19] Disable unused version. --- .github/workflows/codestyle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 0dbddf8f72..73cf358c57 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -46,7 +46,7 @@ jobs: image: pipelinecomponents/php-codesniffer:latest strategy: matrix: - PHPVERSION: ["8.1", "8.2", "8.3", "8.4"] + PHPVERSION: ["8.2", "8.3", "8.4"] steps: - run: apk add git - uses: actions/checkout@v4 From 823c571293dbaffa3bc5a4c8e2134a2963c0bef3 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:18:31 +0100 Subject: [PATCH 03/19] Fix syntax job --- .github/jobs/fix_pipelinecomponents_image.sh | 23 -------------------- 1 file changed, 23 deletions(-) diff --git a/.github/jobs/fix_pipelinecomponents_image.sh b/.github/jobs/fix_pipelinecomponents_image.sh index b80c217827..76e1d4ab47 100755 --- a/.github/jobs/fix_pipelinecomponents_image.sh +++ b/.github/jobs/fix_pipelinecomponents_image.sh @@ -2,26 +2,3 @@ # Leave urly to show the currently failing steps exit 0 - -# We can't convert this script to bash as GHA doesn't have bash installed -# -# The current script doesn't use a piped command so the "benefit" of using -# pipefail is not there over the hassle of maintaining another container. -set -eux - -echo "Set plugin config for version detection" -phpcs --config-set installed_paths /app/vendor/phpcompatibility/php-compatibility - -# Current released version does not know enums -echo "Upgrade the compatibility for PHP versions" -mydir=$(pwd) - -echo "Before /app/composer.json:" -cat /app/composer.json -sed -i 's/"phpcompatibility\/php-compatibility": "9.3.5"/"phpcompatibility\/php-compatibility": "dev-develop"/g' /app/composer.json -sed -i 's/"squizlabs\/php_codesniffer": "3.13.2"/"squizlabs\/php_codesniffer": "^3.13.3"/g' /app/composer.json -echo "After /app/composer.json:" -cat /app/composer.json - -cd /app; composer update -cd $mydir From d1baabe692767aeae8945cf04fac9a527f087c06 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:18:54 +0100 Subject: [PATCH 04/19] Revert "Fix syntax job" This reverts commit 823c571293dbaffa3bc5a4c8e2134a2963c0bef3. --- .github/jobs/fix_pipelinecomponents_image.sh | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/jobs/fix_pipelinecomponents_image.sh b/.github/jobs/fix_pipelinecomponents_image.sh index 76e1d4ab47..b80c217827 100755 --- a/.github/jobs/fix_pipelinecomponents_image.sh +++ b/.github/jobs/fix_pipelinecomponents_image.sh @@ -2,3 +2,26 @@ # Leave urly to show the currently failing steps exit 0 + +# We can't convert this script to bash as GHA doesn't have bash installed +# +# The current script doesn't use a piped command so the "benefit" of using +# pipefail is not there over the hassle of maintaining another container. +set -eux + +echo "Set plugin config for version detection" +phpcs --config-set installed_paths /app/vendor/phpcompatibility/php-compatibility + +# Current released version does not know enums +echo "Upgrade the compatibility for PHP versions" +mydir=$(pwd) + +echo "Before /app/composer.json:" +cat /app/composer.json +sed -i 's/"phpcompatibility\/php-compatibility": "9.3.5"/"phpcompatibility\/php-compatibility": "dev-develop"/g' /app/composer.json +sed -i 's/"squizlabs\/php_codesniffer": "3.13.2"/"squizlabs\/php_codesniffer": "^3.13.3"/g' /app/composer.json +echo "After /app/composer.json:" +cat /app/composer.json + +cd /app; composer update +cd $mydir From 44554a1c4bc911cd165e1148c3e4c1161f9dfc42 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:19:00 +0100 Subject: [PATCH 05/19] Revert "Disable unused version." This reverts commit 30f7aa1a0e4307177c11a34b2551324b584bef94. --- .github/workflows/codestyle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 73cf358c57..0dbddf8f72 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -46,7 +46,7 @@ jobs: image: pipelinecomponents/php-codesniffer:latest strategy: matrix: - PHPVERSION: ["8.2", "8.3", "8.4"] + PHPVERSION: ["8.1", "8.2", "8.3", "8.4"] steps: - run: apk add git - uses: actions/checkout@v4 From 5c4fad3da4d84d1005da36c715f07463bf9cd557 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:19:04 +0100 Subject: [PATCH 06/19] Revert "Trigger CI with no modifications" This reverts commit d56cee00623d99058a7e33916c4b0cb4d7e25194. --- .github/jobs/fix_pipelinecomponents_image.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/jobs/fix_pipelinecomponents_image.sh b/.github/jobs/fix_pipelinecomponents_image.sh index b80c217827..8723b86f1b 100755 --- a/.github/jobs/fix_pipelinecomponents_image.sh +++ b/.github/jobs/fix_pipelinecomponents_image.sh @@ -1,8 +1,5 @@ #!/bin/sh -# Leave urly to show the currently failing steps -exit 0 - # We can't convert this script to bash as GHA doesn't have bash installed # # The current script doesn't use a piped command so the "benefit" of using From 5ba7ee0c2a9cb1c83543aa8a833bdd50c4703c45 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:21:40 +0100 Subject: [PATCH 07/19] Try alternative solution --- .github/jobs/fix_pipelinecomponents_image.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/jobs/fix_pipelinecomponents_image.sh b/.github/jobs/fix_pipelinecomponents_image.sh index 8723b86f1b..5f0be2766b 100755 --- a/.github/jobs/fix_pipelinecomponents_image.sh +++ b/.github/jobs/fix_pipelinecomponents_image.sh @@ -15,10 +15,14 @@ mydir=$(pwd) echo "Before /app/composer.json:" cat /app/composer.json -sed -i 's/"phpcompatibility\/php-compatibility": "9.3.5"/"phpcompatibility\/php-compatibility": "dev-develop"/g' /app/composer.json -sed -i 's/"squizlabs\/php_codesniffer": "3.13.2"/"squizlabs\/php_codesniffer": "^3.13.3"/g' /app/composer.json + +echo "Install the only needed tool" +rm /app/composer.json +cd /app +composer require phpcompatibility/php-compatibility:dev-develop + echo "After /app/composer.json:" cat /app/composer.json -cd /app; composer update +composer update cd $mydir From 66365be83b0f8d30ed3b9da23320c33062004c68 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:30:51 +0100 Subject: [PATCH 08/19] Investigate the warning --- .github/jobs/fix_pipelinecomponents_image.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/jobs/fix_pipelinecomponents_image.sh b/.github/jobs/fix_pipelinecomponents_image.sh index 5f0be2766b..db6e1dfe98 100755 --- a/.github/jobs/fix_pipelinecomponents_image.sh +++ b/.github/jobs/fix_pipelinecomponents_image.sh @@ -19,6 +19,7 @@ cat /app/composer.json echo "Install the only needed tool" rm /app/composer.json cd /app +composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer composer require phpcompatibility/php-compatibility:dev-develop echo "After /app/composer.json:" From e294d064c4223b93b4f50b0b2db44cd25fc11b20 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:45:48 +0100 Subject: [PATCH 09/19] =?UTF-8?q?Re-order=20as=20we=20don=C2=B4t=20get=20a?= =?UTF-8?q?=20simple=20composer.json=20yet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/jobs/fix_pipelinecomponents_image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/jobs/fix_pipelinecomponents_image.sh b/.github/jobs/fix_pipelinecomponents_image.sh index db6e1dfe98..93f7d45067 100755 --- a/.github/jobs/fix_pipelinecomponents_image.sh +++ b/.github/jobs/fix_pipelinecomponents_image.sh @@ -19,8 +19,8 @@ cat /app/composer.json echo "Install the only needed tool" rm /app/composer.json cd /app -composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer composer require phpcompatibility/php-compatibility:dev-develop +composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer echo "After /app/composer.json:" cat /app/composer.json From f765a3b6d8eae14d6e9972161c70a4b27b107ad6 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:58:41 +0100 Subject: [PATCH 10/19] Fixup --- .github/jobs/fix_pipelinecomponents_image.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/jobs/fix_pipelinecomponents_image.sh b/.github/jobs/fix_pipelinecomponents_image.sh index 93f7d45067..32d77a1e52 100755 --- a/.github/jobs/fix_pipelinecomponents_image.sh +++ b/.github/jobs/fix_pipelinecomponents_image.sh @@ -19,11 +19,15 @@ cat /app/composer.json echo "Install the only needed tool" rm /app/composer.json cd /app +set +eu composer require phpcompatibility/php-compatibility:dev-develop -composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer +set -eu + +composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true echo "After /app/composer.json:" cat /app/composer.json +echo "Install the needed tools" composer update cd $mydir From 133f398900512aeaeb07bb8e87e4ecc07fc8cd95 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 18:53:11 +0100 Subject: [PATCH 11/19] Try with the new image --- .github/workflows/codestyle.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 0dbddf8f72..92c8864ce3 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -40,6 +40,29 @@ jobs: webapp/public webapp/config + phpcs_compatibility_new_style: + runs-on: ubuntu-latest + container: + image: domjudge/gitlabci:24.04 + strategy: + matrix: + PHPVERSION: ["8.1", "8.2", "8.3", "8.4"] + steps: + - uses: actions/checkout@v4 + - name: Detect compatibility with supported PHP version + run: > + ./vendor/bin/phpcs -s -p --colors + --standard=PHPCompatibility + --extensions=php + --runtime-set testVersion ${{ matrix.PHPVERSION }} + lib/lib.*.php + etc + judge + webapp/src + webapp/tests + webapp/public + webapp/config + phpcs_compatibility: runs-on: ubuntu-latest container: From 8b96e458be84de7077369f4f20c496f708305e14 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 18:56:17 +0100 Subject: [PATCH 12/19] Fixup --- .github/workflows/codestyle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 92c8864ce3..a34fa2f366 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -51,7 +51,7 @@ jobs: - uses: actions/checkout@v4 - name: Detect compatibility with supported PHP version run: > - ./vendor/bin/phpcs -s -p --colors + /app/vendor/bin/phpcs -s -p --colors --standard=PHPCompatibility --extensions=php --runtime-set testVersion ${{ matrix.PHPVERSION }} From fcad923cf948c4f8883c6605a6ba74517fd8fe9c Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:35:09 +0100 Subject: [PATCH 13/19] use the correct path --- .github/workflows/codestyle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index a34fa2f366..98ecd43ed1 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -51,7 +51,7 @@ jobs: - uses: actions/checkout@v4 - name: Detect compatibility with supported PHP version run: > - /app/vendor/bin/phpcs -s -p --colors + /vendor/bin/phpcs -s -p --colors --standard=PHPCompatibility --extensions=php --runtime-set testVersion ${{ matrix.PHPVERSION }} From 9305063b9fc294e96c9aece4fd3288a260d5db0a Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:55:14 +0100 Subject: [PATCH 14/19] Add something new to check that PHPCompatability breaks --- judge/judgedaemon.main.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php index 4b4a56ae4d..6302cc35c8 100644 --- a/judge/judgedaemon.main.php +++ b/judge/judgedaemon.main.php @@ -1779,5 +1779,10 @@ private function initsignals(): void } } +$result = "Hello World" + |> strtoupper(...) + |> str_shuffle(...) + |> trim(...); + $daemon = new JudgeDaemon(); $daemon->run(); From d337309b0a913943df0e09796bcc0619c9a8b0d8 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Mon, 8 Dec 2025 23:20:46 +0100 Subject: [PATCH 15/19] Add some "mistakes" to catch them. --- judge/judgedaemon.main.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php index 6302cc35c8..0cd34901de 100644 --- a/judge/judgedaemon.main.php +++ b/judge/judgedaemon.main.php @@ -1784,5 +1784,25 @@ private function initsignals(): void |> str_shuffle(...) |> trim(...); +interface I { + // We may naively assume that the PHP constant is always a string. + const PHP = 'PHP 8.2'; +} + +class Foo implements I { + // But implementing classes may define it as an array. + const PHP = []; +} + +class Foo2 { + const PHP = 'PHP 8.3'; +} + +$searchableConstant = 'PHP'; + +var_dump(json_validate('{ "test": { "foo": "bar" } }')); // true + +var_dump(Foo2::{$searchableConstant}); + $daemon = new JudgeDaemon(); $daemon->run(); From 9ba73262b2ffe11a52992403894453799fa06148 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:54:40 +0100 Subject: [PATCH 16/19] Trigger with the new PHP version --- .github/workflows/codestyle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 98ecd43ed1..d936ffd8bc 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -46,7 +46,7 @@ jobs: image: domjudge/gitlabci:24.04 strategy: matrix: - PHPVERSION: ["8.1", "8.2", "8.3", "8.4"] + PHPVERSION: ["8.1", "8.2", "8.3", "8.4", "8.5"] steps: - uses: actions/checkout@v4 - name: Detect compatibility with supported PHP version From 6b6929399da3256055b8b8e37be972a20d4ae61e Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:53:41 +0100 Subject: [PATCH 17/19] Fix the image again --- .github/workflows/codestyle.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index d936ffd8bc..11e387daf9 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -49,6 +49,8 @@ jobs: PHPVERSION: ["8.1", "8.2", "8.3", "8.4", "8.5"] steps: - uses: actions/checkout@v4 + - name: Trigger the plugin + run: composer install - name: Detect compatibility with supported PHP version run: > /vendor/bin/phpcs -s -p --colors From bf753ff2355b51bd1a92f177c9b962d83ffe5d62 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:58:58 +0100 Subject: [PATCH 18/19] Use right dir --- .github/workflows/codestyle.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 11e387daf9..4623ef24ca 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -50,7 +50,11 @@ jobs: steps: - uses: actions/checkout@v4 - name: Trigger the plugin - run: composer install + run: > + olddir=`pwd` + cd / + composer install + cd "$olddir" - name: Detect compatibility with supported PHP version run: > /vendor/bin/phpcs -s -p --colors From 3279533761f4ec8019d5d8c8359d34ec3bc546b4 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 15:05:18 +0100 Subject: [PATCH 19/19] Use right syntax --- .github/workflows/codestyle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 4623ef24ca..48f3c3d62a 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -50,7 +50,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Trigger the plugin - run: > + run: | olddir=`pwd` cd / composer install