From 1b2560c70ee4dd371f3d64f1e656bf154af01953 Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Tue, 4 Jun 2024 10:54:57 +0200 Subject: [PATCH 1/9] Add php 8.3 to CI --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b9afeb572..d5fec84918 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,7 @@ jobs: - "8.0" - "8.1" - "8.2" + - "8.3" services: mysql: From 1762e6089424fb12560b0b601f2f2bce7077192c Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Tue, 4 Jun 2024 10:56:19 +0200 Subject: [PATCH 2/9] Fix PHP 8.3 deprecation --- framework/base/CApplication.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/base/CApplication.php b/framework/base/CApplication.php index 61d1602989..0d5fa0d1b2 100644 --- a/framework/base/CApplication.php +++ b/framework/base/CApplication.php @@ -427,8 +427,8 @@ public function getLocaleDataPath() */ public function setLocaleDataPath($value) { - $property=new ReflectionProperty($this->localeClass,'dataPath'); - $property->setValue($value); + $class=new ReflectionClass($this->localeClass); + $class->setStaticPropertyValue('dataPath',$value); } /** From 1b95757ab777f8c0edad85c1cfc94cc78772e00e Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Tue, 4 Jun 2024 10:57:32 +0200 Subject: [PATCH 3/9] Update CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 3551a52760..d0e99fb3aa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ Version 1.1.30 under development - Bug #4547: PHP 8 compatibility: Fix deprecation in CCaptcha when using Imagick extension (apphp) - Bug #4541: PHP 8 compatibility: Fix deprecation in MarkdownParser (mdeweerd) - Bug #4544: PHP 8 compatibility: Fix deprecation in CLocale (apphp) +- Enh #4552: Added support for PHP 8.3 (sandippingle, marcovtwout) Version 1.1.29 November 14, 2023 -------------------------------- From baf51652ca70eeb2621dde6d2e2299cd41a1cad7 Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Tue, 4 Jun 2024 14:06:43 +0200 Subject: [PATCH 4/9] Attempt to fix failing unit tests that use runInSeparateProcess --- tests/framework/web/CCookieCollectionTest.php | 2 ++ tests/framework/web/CHttpSessionTest.php | 1 + tests/framework/web/auth/CWebUserTest.php | 2 ++ 3 files changed, 5 insertions(+) diff --git a/tests/framework/web/CCookieCollectionTest.php b/tests/framework/web/CCookieCollectionTest.php index f217421b4b..999ee90cd2 100644 --- a/tests/framework/web/CCookieCollectionTest.php +++ b/tests/framework/web/CCookieCollectionTest.php @@ -38,6 +38,7 @@ public function testConstructorCookieBuilding() } /** * @runInSeparateProcess + * @preserveGlobalState disabled * @outputBuffering enabled */ public function testAdd() @@ -59,6 +60,7 @@ public function testAdd() } /** * @runInSeparateProcess + * @preserveGlobalState disabled * @outputBuffering enabled */ public function testRemove() diff --git a/tests/framework/web/CHttpSessionTest.php b/tests/framework/web/CHttpSessionTest.php index d904b028e4..cab82abf4a 100644 --- a/tests/framework/web/CHttpSessionTest.php +++ b/tests/framework/web/CHttpSessionTest.php @@ -16,6 +16,7 @@ protected function checkProb($gcProb) { * @covers CHttpSession::setGCProbability * * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testSetGet() { Yii::app()->setComponents(array('session' => array( diff --git a/tests/framework/web/auth/CWebUserTest.php b/tests/framework/web/auth/CWebUserTest.php index 12e6305375..bdfec6aea4 100644 --- a/tests/framework/web/auth/CWebUserTest.php +++ b/tests/framework/web/auth/CWebUserTest.php @@ -31,6 +31,7 @@ public function booleanProvider() /** * @runInSeparateProcess + * @preserveGlobalState disabled * @outputBuffering enabled * @dataProvider booleanProvider */ @@ -59,6 +60,7 @@ public function testLoginLogout($destroySession) /** * @runInSeparateProcess + * @preserveGlobalState disabled * @outputBuffering enabled */ public function testCheckAccess() From 46405c43e67d50b863cf0c49959d559dc919d41f Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Tue, 4 Jun 2024 15:02:40 +0200 Subject: [PATCH 5/9] Attempt to fix failing unit tests that use runInSeparateProcess --- composer.json | 3 ++- tests/phpunit_php83.patch | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/phpunit_php83.patch diff --git a/composer.json b/composer.json index 932558e60a..fb980afddc 100644 --- a/composer.json +++ b/composer.json @@ -108,7 +108,8 @@ "phpunit/phpunit": { "Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch", "Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch", - "Fix PHP 8.1 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php81.patch" + "Fix PHP 8.1 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php81.patch", + "Fix PHP 8.3 compatibility": "tests/phpunit_php83.patch" } } }, diff --git a/tests/phpunit_php83.patch b/tests/phpunit_php83.patch new file mode 100644 index 0000000000..cdcafe842f --- /dev/null +++ b/tests/phpunit_php83.patch @@ -0,0 +1,11 @@ +--- a/src/Util/PHP/Template/TestCaseMethod.tpl.dist ++++ b/src/Util/PHP/Template/TestCaseMethod.tpl.dist +@@ -56,7 +56,7 @@ + } + + @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ +- if ($stdout = stream_get_contents(STDOUT)) { ++ if ($stdout = @stream_get_contents(STDOUT)) { + $output = $stdout . $output; + } + From 64d827d9b9d2d408b3b7936f03fd07e40520e76c Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Wed, 18 Sep 2024 10:29:10 +0200 Subject: [PATCH 6/9] Update CVarDumper::dumpAsString() for PHP 8.3 Taken from https://github.com/yiisoft/yii/pull/4562 --- framework/utils/CVarDumper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/utils/CVarDumper.php b/framework/utils/CVarDumper.php index a8e78b86ae..ce834674a9 100644 --- a/framework/utils/CVarDumper.php +++ b/framework/utils/CVarDumper.php @@ -60,7 +60,7 @@ public static function dumpAsString($var,$depth=10,$highlight=false) if($highlight) { $result=highlight_string("/','',$result,1); + self::$_output=preg_replace('/<\\?php(
|\\n)/','',$result,1); } return self::$_output; } From 0d999769a6a868d8189a6ec0db2763e7e3ed8bf4 Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Wed, 18 Sep 2024 10:31:06 +0200 Subject: [PATCH 7/9] Update CHANGELOG --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index d0e99fb3aa..127e78c486 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,7 +7,7 @@ Version 1.1.30 under development - Bug #4547: PHP 8 compatibility: Fix deprecation in CCaptcha when using Imagick extension (apphp) - Bug #4541: PHP 8 compatibility: Fix deprecation in MarkdownParser (mdeweerd) - Bug #4544: PHP 8 compatibility: Fix deprecation in CLocale (apphp) -- Enh #4552: Added support for PHP 8.3 (sandippingle, marcovtwout) +- Enh #4552: Added support for PHP 8.3 (sandippingle, ThePepster, marcovtwout) Version 1.1.29 November 14, 2023 -------------------------------- From 9d657a562bb6d8b73ca422a333e50e8b130c0c5e Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Wed, 18 Sep 2024 16:25:44 +0200 Subject: [PATCH 8/9] Patch moved upstream --- composer.json | 2 +- tests/phpunit_php83.patch | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 tests/phpunit_php83.patch diff --git a/composer.json b/composer.json index fb980afddc..a335b2f1e2 100644 --- a/composer.json +++ b/composer.json @@ -109,7 +109,7 @@ "Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch", "Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch", "Fix PHP 8.1 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php81.patch", - "Fix PHP 8.3 compatibility": "tests/phpunit_php83.patch" + "Fix PHP 8.3 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php83.patch" } } }, diff --git a/tests/phpunit_php83.patch b/tests/phpunit_php83.patch deleted file mode 100644 index cdcafe842f..0000000000 --- a/tests/phpunit_php83.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/Util/PHP/Template/TestCaseMethod.tpl.dist -+++ b/src/Util/PHP/Template/TestCaseMethod.tpl.dist -@@ -56,7 +56,7 @@ - } - - @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ -- if ($stdout = stream_get_contents(STDOUT)) { -+ if ($stdout = @stream_get_contents(STDOUT)) { - $output = $stdout . $output; - } - From ddb22adfc4468896761003f39a34ec79d25697bf Mon Sep 17 00:00:00 2001 From: Marco van 't Wout Date: Wed, 18 Sep 2024 16:57:57 +0200 Subject: [PATCH 9/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 742d2ab930..862d12d439 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Thank you for choosing Yii - a high-performance component-based PHP framework. and will only receive necessary security fixes and fixes to adjust the code for compatibility with PHP 7 and 8 if they do not cause breaking changes. This allows you to keep your servers PHP version up to date in the environments where old Yii 1.1 applications are hosted and stay within the [version ranges supported by the PHP team](http://php.net/supported-versions.php). > -> Currently tested and supported [up to PHP 8.2](https://github.com/yiisoft/yii/blob/master/.github/workflows/build.yml#L34). +> Currently tested and supported [up to PHP 8.3](https://github.com/yiisoft/yii/blob/master/.github/workflows/build.yml#L34). INSTALLATION ------------