From 436457338c6640e7e7c8d5a012d3b8c3b0f6c094 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 8 Sep 2023 10:17:23 +0900 Subject: [PATCH 1/2] fix: deprecated code in PHP 8.3 Calling ReflectionProperty::setValue() with a 1st argument which is not null or an object is deprecated --- system/Test/ReflectionHelper.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/Test/ReflectionHelper.php b/system/Test/ReflectionHelper.php index 8ada8e76da59..4c25e3decd89 100644 --- a/system/Test/ReflectionHelper.php +++ b/system/Test/ReflectionHelper.php @@ -74,7 +74,12 @@ private static function getAccessibleRefProperty($obj, $property) public static function setPrivateProperty($obj, $property, $value) { $refProperty = self::getAccessibleRefProperty($obj, $property); - $refProperty->setValue($obj, $value); + + if (is_object($obj)) { + $refProperty->setValue($obj, $value); + } else { + $refProperty->setValue(null, $value); + } } /** From ddd2317bd0c7020b07793468e1fafdc96c89f09b Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 8 Sep 2023 10:18:18 +0900 Subject: [PATCH 2/2] test: fix deprecated code in PHP 8.3 --- tests/system/CLI/CLITest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index e7a9264c8791..f0f455f8aeb7 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -438,13 +438,13 @@ public function testWindow(): void { $height = new ReflectionProperty(CLI::class, 'height'); $height->setAccessible(true); - $height->setValue(null); + $height->setValue(null, null); $this->assertIsInt(CLI::getHeight()); $width = new ReflectionProperty(CLI::class, 'width'); $width->setAccessible(true); - $width->setValue(null); + $width->setValue(null, null); $this->assertIsInt(CLI::getWidth()); }