From e2e2c61b8fb3ca82a9a3767795f8b0e22aa8a42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rancoud?= Date: Tue, 12 Dec 2023 00:38:22 +0100 Subject: [PATCH 1/2] feat: add php 8.3 for github workflow test --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0becd01..525b6eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,7 @@ jobs: - '8.0' - '8.1' - '8.2' + - '8.3' steps: - name: Checkout From 232922c1946abdd981fe01d37ebf698abce81d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rancoud?= Date: Tue, 12 Dec 2023 01:07:54 +0100 Subject: [PATCH 2/2] fix tests for php 8.3 --- tests/SessionTest.php | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/tests/SessionTest.php b/tests/SessionTest.php index f0bf792..b3e0861 100644 --- a/tests/SessionTest.php +++ b/tests/SessionTest.php @@ -22,25 +22,47 @@ protected function setUp(): void $class = new ReflectionClass(Session::class); $propHasStarted = $class->getProperty('hasStarted'); $propHasStarted->setAccessible(true); - $propHasStarted->setValue(false); + if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3) { + $class->setStaticPropertyValue('hasStarted', false); + } else { + $propHasStarted->setValue(false); + } $propDriver = $class->getProperty('driver'); $propDriver->setAccessible(true); - $propDriver->setValue(null); + if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3) { + $class->setStaticPropertyValue('driver', null); + } else { + $propDriver->setValue(null); + } $propHasChanged = $class->getProperty('hasChanged'); $propHasChanged->setAccessible(true); - $propHasChanged->setValue(true); + if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3) { + $class->setStaticPropertyValue('hasChanged', true); + } else { + $propHasChanged->setValue(true); + } $propOptions = $class->getProperty('options'); $propOptions->setAccessible(true); - $propOptions->setValue([ - 'read_and_close' => true, - 'cookie_httponly' => '1', - 'use_only_cookies' => '1', - 'use_trans_sid' => '0', - 'use_strict_mode' => '1' - ]); + if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3) { + $class->setStaticPropertyValue('options', [ + 'read_and_close' => true, + 'cookie_httponly' => '1', + 'use_only_cookies' => '1', + 'use_trans_sid' => '0', + 'use_strict_mode' => '1' + ]); + } else { + $propOptions->setValue([ + 'read_and_close' => true, + 'cookie_httponly' => '1', + 'use_only_cookies' => '1', + 'use_trans_sid' => '0', + 'use_strict_mode' => '1' + ]); + } $path = \ini_get('session.save_path'); if (empty($path)) {