From 07ab15309364ee063ac58d7b585ed6aca4745777 Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Fri, 6 Dec 2024 14:24:40 -0800 Subject: [PATCH 1/4] Remove mention of PHP 7.4 Per the 202409 changelog, the next release will not support PHP 7.4. This PR removes any mention of PHP 7.4. Very importantly, it removes the PHP 7.4 CI so we can rely on the updated type system in PHP 8.1 (e.g. `mixed`). Right now, adding those types makes PHP 7.4 CI unhappy. --- .github/workflows/ci.yml | 3 --- SETUP/INSTALL.md | 13 ++++++------- SETUP/tests/unittests/ParamValidatorTest.php | 7 ++++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b909f34e1..b1dbbf7db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,6 @@ jobs: strategy: matrix: cfg: - - { os: 'ubuntu-20.04', php: '7.4' } - { os: 'ubuntu-22.04', php: '8.1' } - { os: 'ubuntu-22.04', php: '8.3' } runs-on: ${{ matrix.cfg.os }} @@ -39,7 +38,6 @@ jobs: strategy: matrix: cfg: - - { os: 'ubuntu-20.04', php: '7.4' } - { os: 'ubuntu-22.04', php: '8.1' } - { os: 'ubuntu-22.04', php: '8.3' } runs-on: ${{ matrix.cfg.os }} @@ -106,7 +104,6 @@ jobs: strategy: matrix: cfg: - - { os: 'ubuntu-20.04', php: '7.4' } - { os: 'ubuntu-22.04', php: '8.1' } - { os: 'ubuntu-22.04', php: '8.3' } runs-on: ${{ matrix.cfg.os }} diff --git a/SETUP/INSTALL.md b/SETUP/INSTALL.md index 63a06f40a..6c3f94ea9 100644 --- a/SETUP/INSTALL.md +++ b/SETUP/INSTALL.md @@ -16,8 +16,8 @@ The following lists supported versions for the four primary middleware components. ### PHP -PHP version 7.4 is the minimum supported version. Limited testing has been done -on PHP 8.1 and 8.3. +PHP version 8.1 is the minimum supported version. Limited testing has been done +on PHP 8.3. The following PHP extensions are required. They are listed below with their Ubuntu system package names. @@ -50,11 +50,10 @@ change `core.disable_super_globals` to `false`, and flush the phpbb cache. ## Distro support These middleware components match the following major distribution releases: -* Ubuntu 18.04, Bionic (with PHP 7.4 upgrade) -* Ubuntu 20.04, Focal -* Ubuntu 22.04, Jammy (with possible PHP 7.4 downgrade) -* RHEL / CentOS 7.x family (with PHP 7.4 and MariaDB 10.2 or later upgrade) -* RHEL / CentOS 8.x family +* Ubuntu 20.04, Focal (with PHP 8.1 upgrade) +* Ubuntu 22.04, Jammy +* RHEL / CentOS 8.x family (with PHP 8.1 upgrade) +* RHEL / CentOS 9.x family ## Browser support The following are the lowest known supported browser versions for the code: diff --git a/SETUP/tests/unittests/ParamValidatorTest.php b/SETUP/tests/unittests/ParamValidatorTest.php index 864d5e48a..926bfdf9b 100644 --- a/SETUP/tests/unittests/ParamValidatorTest.php +++ b/SETUP/tests/unittests/ParamValidatorTest.php @@ -374,9 +374,10 @@ public function testBoolFalseVariants() public function testBoolDefaultNotBool() { - // Shockingly, PHP 7.4 (at least) will not throw a TypeError if a - // non-boolean is passed into a function with a bool type. It instead - // coerces it into a bool. Maybe later versions will? + // PHP will not throw a TypeError if a non-boolean is passed + // into a function with a bool type. It instead coerces it into a bool. + // This is expected and there is nothing we can do about it... + // As it is unlikely to change, keeping this test around for documentation. $this->markTestSkipped('PHP will not enforce a bool type'); $this->expectException(TypeError::class); From 84922749af7bcba0fa6df9823ba0c7cae52173e3 Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Sat, 7 Dec 2024 14:57:53 -0800 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Casey Peel --- SETUP/INSTALL.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SETUP/INSTALL.md b/SETUP/INSTALL.md index 6c3f94ea9..7c67c54a7 100644 --- a/SETUP/INSTALL.md +++ b/SETUP/INSTALL.md @@ -16,8 +16,8 @@ The following lists supported versions for the four primary middleware components. ### PHP -PHP version 8.1 is the minimum supported version. Limited testing has been done -on PHP 8.3. +PHP version 8.1 is the minimum supported version although limited testing has been done +on PHP versions < 8.3. The following PHP extensions are required. They are listed below with their Ubuntu system package names. @@ -52,6 +52,7 @@ change `core.disable_super_globals` to `false`, and flush the phpbb cache. These middleware components match the following major distribution releases: * Ubuntu 20.04, Focal (with PHP 8.1 upgrade) * Ubuntu 22.04, Jammy +* Ubuntu 24.04, Noble * RHEL / CentOS 8.x family (with PHP 8.1 upgrade) * RHEL / CentOS 9.x family From 95f175fdd48cd1fedc108df12f54fd819f7a599c Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Sat, 7 Dec 2024 15:02:21 -0800 Subject: [PATCH 3/4] Replace testBoolDefaultNotBool with comment --- SETUP/tests/unittests/ParamValidatorTest.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/SETUP/tests/unittests/ParamValidatorTest.php b/SETUP/tests/unittests/ParamValidatorTest.php index 926bfdf9b..279be0e2e 100644 --- a/SETUP/tests/unittests/ParamValidatorTest.php +++ b/SETUP/tests/unittests/ParamValidatorTest.php @@ -372,19 +372,9 @@ public function testBoolFalseVariants() $this->assertEquals(false, $result); } - public function testBoolDefaultNotBool() - { - // PHP will not throw a TypeError if a non-boolean is passed - // into a function with a bool type. It instead coerces it into a bool. - // This is expected and there is nothing we can do about it... - // As it is unlikely to change, keeping this test around for documentation. - $this->markTestSkipped('PHP will not enforce a bool type'); - - $this->expectException(TypeError::class); - $this->expectExceptionMessage("must be of"); - $default = "string"; - get_bool_param($this->GET, 'none', $default); - } + // We don't test passing a non-boolean `$default` to `get_bool_param` as PHP will + // automatically coerce it to bool. Also there is no way to disable this behavior. + // If there is in the future, we should look at enabling it though. public function testBoolNotABool() { From 494013045f0722d1fd1cc48f5dbf481a2145293a Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Sat, 7 Dec 2024 15:03:30 -0800 Subject: [PATCH 4/4] Remove str_contains shim --- pinc/misc.inc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pinc/misc.inc b/pinc/misc.inc index 9594dc6c3..688d08c80 100644 --- a/pinc/misc.inc +++ b/pinc/misc.inc @@ -809,14 +809,6 @@ function endswith($subject, $suffix) return (substr($subject, -strlen($suffix)) == $suffix); } -if (!function_exists('str_contains')) { - // str_contains() now exists in PHP8 - function str_contains($haystack, $needle) - { - return (strpos($haystack, $needle) !== false); - } -} - function surround_and_join($strings, $L, $R, $joiner) { $parts = [];