From 213711a2f3f7982aaa07d3e6df0d8fc51735fca3 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 09:08:47 +0800 Subject: [PATCH 01/31] [12.x] PHP 8.5 Compatibility Signed-off-by: Mior Muhammad Zaki --- .github/workflows/tests.yml | 12 ++++++++++++ composer.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 952e51424b53..0d833bd22608 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,6 +48,18 @@ jobs: - php: 8.2 phpunit: '12.4.0' include: + - php: 8.5 + phpunit: '12.1.0' + stability: prefer-stable + - php: 8.5 + phpunit: '12.2.0' + stability: prefer-stable + - php: 8.5 + phpunit: '12.3.0' + stability: prefer-stable + - php: 8.5 + phpunit: '12.4.0' + stability: prefer-stable - php: 8.3 phpunit: '12.1.0' stability: prefer-stable diff --git a/composer.json b/composer.json index 1f9c0b186f15..a11b2b076097 100644 --- a/composer.json +++ b/composer.json @@ -115,7 +115,7 @@ "league/flysystem-sftp-v3": "^3.25.1", "mockery/mockery": "^1.6.10", "opis/json-schema": "^2.4.1", - "orchestra/testbench-core": "^10.7.0", + "orchestra/testbench-core": "^10.8.0", "pda/pheanstalk": "^5.0.6|^7.0.0", "php-http/discovery": "^1.15", "phpstan/phpstan": "^2.0", From a9bb365a3631f1763334041fd2f2e8ef084d9437 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 09:18:23 +0800 Subject: [PATCH 02/31] Update `config/database.php` Signed-off-by: Mior Muhammad Zaki --- config/database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/database.php b/config/database.php index 1d9883833e62..8298041ee1b8 100644 --- a/config/database.php +++ b/config/database.php @@ -61,7 +61,7 @@ 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + (PHP_VERSION_ID >= 80500 ? Pdo\Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], @@ -81,7 +81,7 @@ 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + (PHP_VERSION_ID >= 80500 ? Pdo\Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], From e820c232d8274991998685f120b3005bfd49d01d Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 09:23:15 +0800 Subject: [PATCH 03/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Database/Schema/MySqlSchemaState.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Schema/MySqlSchemaState.php b/src/Illuminate/Database/Schema/MySqlSchemaState.php index 427c943ff736..0a4fdf831455 100644 --- a/src/Illuminate/Database/Schema/MySqlSchemaState.php +++ b/src/Illuminate/Database/Schema/MySqlSchemaState.php @@ -111,7 +111,7 @@ protected function connectionString() ? ' --socket="${:LARAVEL_LOAD_SOCKET}"' : ' --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}"'; - if (isset($config['options'][\PDO::MYSQL_ATTR_SSL_CA])) { + if (isset($config['options'][(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA)])) { $value .= ' --ssl-ca="${:LARAVEL_LOAD_SSL_CA}"'; } From 736f16195ea88e171fc4cf78562f3d36635cd5f4 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Thu, 20 Nov 2025 01:23:37 +0000 Subject: [PATCH 04/31] Apply fixes from StyleCI --- src/Illuminate/Database/Schema/MySqlSchemaState.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Schema/MySqlSchemaState.php b/src/Illuminate/Database/Schema/MySqlSchemaState.php index 0a4fdf831455..137ec711d069 100644 --- a/src/Illuminate/Database/Schema/MySqlSchemaState.php +++ b/src/Illuminate/Database/Schema/MySqlSchemaState.php @@ -111,7 +111,7 @@ protected function connectionString() ? ' --socket="${:LARAVEL_LOAD_SOCKET}"' : ' --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}"'; - if (isset($config['options'][(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA)])) { + if (isset($config['options'][PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA])) { $value .= ' --ssl-ca="${:LARAVEL_LOAD_SSL_CA}"'; } From b902f0475d0e01823e1f35122718285aa38b0440 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 09:40:46 +0800 Subject: [PATCH 05/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Database/Schema/MySqlSchemaState.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Database/Schema/MySqlSchemaState.php b/src/Illuminate/Database/Schema/MySqlSchemaState.php index 137ec711d069..86024e2eabeb 100644 --- a/src/Illuminate/Database/Schema/MySqlSchemaState.php +++ b/src/Illuminate/Database/Schema/MySqlSchemaState.php @@ -111,6 +111,7 @@ protected function connectionString() ? ' --socket="${:LARAVEL_LOAD_SOCKET}"' : ' --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}"'; + /** @phpstan-ignore class.notFound */ if (isset($config['options'][PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA])) { $value .= ' --ssl-ca="${:LARAVEL_LOAD_SSL_CA}"'; } From 02c12275e073932a7b5427737b35550db0ea6875 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 09:44:23 +0800 Subject: [PATCH 06/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Database/Schema/MySqlSchemaState.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Schema/MySqlSchemaState.php b/src/Illuminate/Database/Schema/MySqlSchemaState.php index 86024e2eabeb..11ee235230d6 100644 --- a/src/Illuminate/Database/Schema/MySqlSchemaState.php +++ b/src/Illuminate/Database/Schema/MySqlSchemaState.php @@ -141,7 +141,7 @@ protected function baseVariables(array $config) 'LARAVEL_LOAD_USER' => $config['username'], 'LARAVEL_LOAD_PASSWORD' => $config['password'] ?? '', 'LARAVEL_LOAD_DATABASE' => $config['database'], - 'LARAVEL_LOAD_SSL_CA' => $config['options'][\PDO::MYSQL_ATTR_SSL_CA] ?? '', + 'LARAVEL_LOAD_SSL_CA' => $config['options'][PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA] ?? '', ]; } From ff715993f5af6ea68039f8707a8504b17b17fbd8 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 09:48:19 +0800 Subject: [PATCH 07/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Database/Schema/MySqlSchemaState.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Schema/MySqlSchemaState.php b/src/Illuminate/Database/Schema/MySqlSchemaState.php index 11ee235230d6..9c922a6e580e 100644 --- a/src/Illuminate/Database/Schema/MySqlSchemaState.php +++ b/src/Illuminate/Database/Schema/MySqlSchemaState.php @@ -141,7 +141,7 @@ protected function baseVariables(array $config) 'LARAVEL_LOAD_USER' => $config['username'], 'LARAVEL_LOAD_PASSWORD' => $config['password'] ?? '', 'LARAVEL_LOAD_DATABASE' => $config['database'], - 'LARAVEL_LOAD_SSL_CA' => $config['options'][PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA] ?? '', + 'LARAVEL_LOAD_SSL_CA' => $config['options'][PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA] ?? '', // @phpstan-ignore class.notFound ]; } From a268882f25844132f8f2fd9cd1b66f35544ecda0 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 09:53:15 +0800 Subject: [PATCH 08/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Database/DatabaseMySqlSchemaStateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Database/DatabaseMySqlSchemaStateTest.php b/tests/Database/DatabaseMySqlSchemaStateTest.php index 08603621275f..e1b4be9f9eca 100644 --- a/tests/Database/DatabaseMySqlSchemaStateTest.php +++ b/tests/Database/DatabaseMySqlSchemaStateTest.php @@ -65,7 +65,7 @@ public static function provider(): Generator 'username' => 'root', 'database' => 'forge', 'options' => [ - \PDO::MYSQL_ATTR_SSL_CA => 'ssl.ca', + PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA => 'ssl.ca', ], ], ]; From d68663dbfc5588d2d6de158419f60a94ed0e1023 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 10:32:01 +0800 Subject: [PATCH 09/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Collections/Arr.php | 2 +- tests/Support/SupportCollectionTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Collections/Arr.php b/src/Illuminate/Collections/Arr.php index c5671fefc5f1..dc3be1122815 100644 --- a/src/Illuminate/Collections/Arr.php +++ b/src/Illuminate/Collections/Arr.php @@ -852,7 +852,7 @@ public static function prepend($array, $value, $key = '') if (func_num_args() == 2) { array_unshift($array, $value); } else { - $array = [$key => $value] + $array; + $array = [($key ?? '') => $value] + $array; } return $array; diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 7438266c855c..3dc6cb0c0894 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -4231,7 +4231,7 @@ public function testPrepend() $c = new Collection(['one' => 1, 'two' => 2]); $this->assertEquals( - [null => 0, 'one' => 1, 'two' => 2], + [PHP_VERSION_ID >= 80500 ? '' : null => 0, 'one' => 1, 'two' => 2], $c->prepend(0, null)->all() ); } From 7ab300b1a95154e7f15a7ce7bdda53ec667af133 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 10:54:19 +0800 Subject: [PATCH 10/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Database/DatabaseMariaDbSchemaStateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Database/DatabaseMariaDbSchemaStateTest.php b/tests/Database/DatabaseMariaDbSchemaStateTest.php index fff911093b5b..d1342027319b 100644 --- a/tests/Database/DatabaseMariaDbSchemaStateTest.php +++ b/tests/Database/DatabaseMariaDbSchemaStateTest.php @@ -63,7 +63,7 @@ public static function provider(): Generator 'username' => 'root', 'database' => 'forge', 'options' => [ - \PDO::MYSQL_ATTR_SSL_CA => 'ssl.ca', + PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA => 'ssl.ca', ], ], ]; From 53f66333bbf9804f24ebe4bb10e0c6d5dde2f197 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 11:23:42 +0800 Subject: [PATCH 11/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Cache/RedisTagSet.php | 8 +++++++- tests/Integration/Cache/RedisStoreTest.php | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/RedisTagSet.php b/src/Illuminate/Cache/RedisTagSet.php index 82369ff4ed00..cbb4dee0732a 100644 --- a/src/Illuminate/Cache/RedisTagSet.php +++ b/src/Illuminate/Cache/RedisTagSet.php @@ -48,12 +48,18 @@ public function entries() $cursor = $defaultCursorValue; do { - [$cursor, $entries] = $connection->zscan( + $results = $connection->zscan( $this->store->getPrefix().$tagKey, $cursor, ['match' => '*', 'count' => 1000] ); + if (! is_array($results)) { + break; + } + + [$cursor, $entries] = $results; + if (! is_array($entries)) { break; } diff --git a/tests/Integration/Cache/RedisStoreTest.php b/tests/Integration/Cache/RedisStoreTest.php index ede6e7c394f1..21db040ac2bc 100644 --- a/tests/Integration/Cache/RedisStoreTest.php +++ b/tests/Integration/Cache/RedisStoreTest.php @@ -36,6 +36,8 @@ protected function setUp(): void }); parent::setUp(); + + $this->withoutExceptionHandling(); } public function testCacheTtl(): void From 18f86a37576022e9b77bef219ceb7e6c6a7079a6 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 11:23:54 +0800 Subject: [PATCH 12/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Integration/Cache/RedisStoreTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Integration/Cache/RedisStoreTest.php b/tests/Integration/Cache/RedisStoreTest.php index 21db040ac2bc..ede6e7c394f1 100644 --- a/tests/Integration/Cache/RedisStoreTest.php +++ b/tests/Integration/Cache/RedisStoreTest.php @@ -36,8 +36,6 @@ protected function setUp(): void }); parent::setUp(); - - $this->withoutExceptionHandling(); } public function testCacheTtl(): void From dddc0237db5d1574929e4a262042e04a22404b22 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 11:32:36 +0800 Subject: [PATCH 13/31] wip Signed-off-by: Mior Muhammad Zaki --- .github/workflows/tests.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0d833bd22608..723a07c32eff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -131,6 +131,18 @@ jobs: - php: 8.2 phpunit: '12.4.0' include: + - php: 8.5 + phpunit: '12.1.0' + stability: prefer-stable + - php: 8.5 + phpunit: '12.2.0' + stability: prefer-stable + - php: 8.5 + phpunit: '12.3.0' + stability: prefer-stable + - php: 8.5 + phpunit: '12.4.0' + stability: prefer-stable - php: 8.3 phpunit: '12.1.0' stability: prefer-stable From a3816bd14a4f99e4c2deff0980ed4990540f8f15 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 11:34:48 +0800 Subject: [PATCH 14/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Collections/Arr.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Collections/Arr.php b/src/Illuminate/Collections/Arr.php index dc3be1122815..add477eaddb5 100644 --- a/src/Illuminate/Collections/Arr.php +++ b/src/Illuminate/Collections/Arr.php @@ -849,6 +849,10 @@ public static function mapSpread(array $array, callable $callback) */ public static function prepend($array, $value, $key = '') { + if (is_null($key) && version_compare(PHP_VERSION, '8.5.0', '>=')) { + $key = ''; + } + if (func_num_args() == 2) { array_unshift($array, $value); } else { From 305ee2f04a5ef08268b65582ba0d01d1777513a7 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 11:35:36 +0800 Subject: [PATCH 15/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Database/Connectors/Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Connectors/Connector.php b/src/Illuminate/Database/Connectors/Connector.php index a40bd2c6b861..8d0af49a9ae0 100755 --- a/src/Illuminate/Database/Connectors/Connector.php +++ b/src/Illuminate/Database/Connectors/Connector.php @@ -62,7 +62,7 @@ public function createConnection($dsn, array $config, array $options) */ protected function createPdoConnection($dsn, $username, #[\SensitiveParameter] $password, $options) { - return version_compare(phpversion(), '8.4.0', '<') + return version_compare(PHP_VERSION, '8.4.0', '<') ? new PDO($dsn, $username, $password, $options) : PDO::connect($dsn, $username, $password, $options); /** @phpstan-ignore staticMethod.notFound (PHP 8.4) */ } From 14b8303ecc1960c61d6470d2b0073ead0371b9ae Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 12:31:34 +0800 Subject: [PATCH 16/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Collections/Arr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Collections/Arr.php b/src/Illuminate/Collections/Arr.php index add477eaddb5..43a3ebf5179d 100644 --- a/src/Illuminate/Collections/Arr.php +++ b/src/Illuminate/Collections/Arr.php @@ -856,7 +856,7 @@ public static function prepend($array, $value, $key = '') if (func_num_args() == 2) { array_unshift($array, $value); } else { - $array = [($key ?? '') => $value] + $array; + $array = [$key => $value] + $array; } return $array; From df668a6b3f2f3f4d238dfadc72e6b7986b889159 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 15:33:16 +0800 Subject: [PATCH 17/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Collections/Arr.php | 6 +----- tests/Support/SupportArrTest.php | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Collections/Arr.php b/src/Illuminate/Collections/Arr.php index 43a3ebf5179d..f9af13137fbd 100644 --- a/src/Illuminate/Collections/Arr.php +++ b/src/Illuminate/Collections/Arr.php @@ -849,11 +849,7 @@ public static function mapSpread(array $array, callable $callback) */ public static function prepend($array, $value, $key = '') { - if (is_null($key) && version_compare(PHP_VERSION, '8.5.0', '>=')) { - $key = ''; - } - - if (func_num_args() == 2) { + if (func_num_args() == 2 || is_null($key)) { array_unshift($array, $value); } else { $array = [$key => $value] + $array; diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index aae771cd2a17..13b7cb44bc14 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -1061,6 +1061,9 @@ public function testPrepend() $array = Arr::prepend(['one', 'two'], ['zero'], 'key'); $this->assertEquals(['key' => ['zero'], 'one', 'two'], $array); + + $array = Arr::prepend(['one', 'two'], ['zero'], null); + $this->assertEquals([['zero'], 'one', 'two'], $array); } public function testPull() From adfb867072e8e6621feb66fc547012ecffe43cf2 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 15:36:24 +0800 Subject: [PATCH 18/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/SupportCollectionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 3dc6cb0c0894..a28949fcbbe5 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -4231,7 +4231,7 @@ public function testPrepend() $c = new Collection(['one' => 1, 'two' => 2]); $this->assertEquals( - [PHP_VERSION_ID >= 80500 ? '' : null => 0, 'one' => 1, 'two' => 2], + ['' => 0, 'one' => 1, 'two' => 2], $c->prepend(0, null)->all() ); } From 999d415ae012004492f8045c19a0c0a06011ea61 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 15:37:28 +0800 Subject: [PATCH 19/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/SupportCollectionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index a28949fcbbe5..7438266c855c 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -4231,7 +4231,7 @@ public function testPrepend() $c = new Collection(['one' => 1, 'two' => 2]); $this->assertEquals( - ['' => 0, 'one' => 1, 'two' => 2], + [null => 0, 'one' => 1, 'two' => 2], $c->prepend(0, null)->all() ); } From 891cfa44df6e30a2822b90197ba8ddf51d32b967 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 15:39:27 +0800 Subject: [PATCH 20/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Collections/Arr.php | 2 +- tests/Support/SupportArrTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Collections/Arr.php b/src/Illuminate/Collections/Arr.php index f9af13137fbd..c5671fefc5f1 100644 --- a/src/Illuminate/Collections/Arr.php +++ b/src/Illuminate/Collections/Arr.php @@ -849,7 +849,7 @@ public static function mapSpread(array $array, callable $callback) */ public static function prepend($array, $value, $key = '') { - if (func_num_args() == 2 || is_null($key)) { + if (func_num_args() == 2) { array_unshift($array, $value); } else { $array = [$key => $value] + $array; diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index 13b7cb44bc14..40c6acad6b31 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -1063,7 +1063,7 @@ public function testPrepend() $this->assertEquals(['key' => ['zero'], 'one', 'two'], $array); $array = Arr::prepend(['one', 'two'], ['zero'], null); - $this->assertEquals([['zero'], 'one', 'two'], $array); + $this->assertEquals(['one', 'two', '' => ['zero']], $array); } public function testPull() From 7f06dbd8d94d89ffb07568bb101cb4b2f5ecb145 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 15:48:34 +0800 Subject: [PATCH 21/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Cache/RedisCacheIntegrationTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Cache/RedisCacheIntegrationTest.php b/tests/Cache/RedisCacheIntegrationTest.php index d2e4b23fa0e7..76b1e3693cd2 100644 --- a/tests/Cache/RedisCacheIntegrationTest.php +++ b/tests/Cache/RedisCacheIntegrationTest.php @@ -20,6 +20,10 @@ class RedisCacheIntegrationTest extends TestCase protected function setUp(): void { + if (! class_exists(Redis::class)) { + $this->markTestSkipped('The Redis class/extension is not installed. Please install the extension to enable '.__CLASS__); + } + parent::setUp(); $this->setUpRedis(); } From 8d5c174556aed637f9aa6b67b331ab7754844e68 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 15:56:57 +0800 Subject: [PATCH 22/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Collections/Arr.php | 4 ++-- tests/Support/SupportArrTest.php | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/Collections/Arr.php b/src/Illuminate/Collections/Arr.php index c5671fefc5f1..e6586edd7f95 100644 --- a/src/Illuminate/Collections/Arr.php +++ b/src/Illuminate/Collections/Arr.php @@ -844,10 +844,10 @@ public static function mapSpread(array $array, callable $callback) * * @param array $array * @param mixed $value - * @param array-key $key + * @param mixed $key * @return array */ - public static function prepend($array, $value, $key = '') + public static function prepend($array, $value, $key = null) { if (func_num_args() == 2) { array_unshift($array, $value); diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index 40c6acad6b31..9b5f7731b662 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -9,6 +9,7 @@ use Illuminate\Support\ItemNotFoundException; use Illuminate\Support\MultipleItemsFoundException; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\IgnoreDeprecations; use PHPUnit\Framework\TestCase; use stdClass; use WeakMap; @@ -164,6 +165,7 @@ public function testCrossJoin() $this->assertSame([[]], Arr::crossJoin()); } + #[IgnoreDeprecations] public function testDivide(): void { // Test dividing an empty array @@ -187,7 +189,7 @@ public function testDivide(): void $this->assertEquals(['first', 'second'], $values); // Test dividing an array with null key - [$keys, $values] = Arr::divide(['' => 'Null', 1 => 'one']); + [$keys, $values] = Arr::divide([null => 'Null', 1 => 'one']); $this->assertEquals([null, 1], $keys); $this->assertEquals(['Null', 'one'], $values); @@ -197,7 +199,7 @@ public function testDivide(): void $this->assertEquals([['one' => 1, 2 => 'second'], 'one'], $values); // Test dividing an array where the values are arrays - [$keys, $values] = Arr::divide(['' => ['one' => 1, 2 => 'second'], 1 => 'one']); + [$keys, $values] = Arr::divide([null => ['one' => 1, 2 => 'second'], 1 => 'one']); $this->assertEquals([null, 1], $keys); $this->assertEquals([['one' => 1, 2 => 'second'], 'one'], $values); } @@ -1036,6 +1038,7 @@ public function testMapSpread() $this->assertEquals(['1-a-0', '2-b-1'], $result); } + #[IgnoreDeprecations] public function testPrepend() { $array = Arr::prepend(['one', 'two', 'three', 'four'], 'zero'); @@ -1044,8 +1047,8 @@ public function testPrepend() $array = Arr::prepend(['one' => 1, 'two' => 2], 0, 'zero'); $this->assertEquals(['zero' => 0, 'one' => 1, 'two' => 2], $array); - $array = Arr::prepend(['one' => 1, 'two' => 2], 0, ''); - $this->assertEquals(['' => 0, 'one' => 1, 'two' => 2], $array); + $array = Arr::prepend(['one' => 1, 'two' => 2], 0, null); + $this->assertEquals([null => 0, 'one' => 1, 'two' => 2], $array); $array = Arr::prepend(['one', 'two'], null, ''); $this->assertEquals(['' => null, 'one', 'two'], $array); @@ -1516,6 +1519,7 @@ public function testWhereKey() $this->assertEquals(['10' => 1, 20 => 2], $array); } + #[IgnoreDeprecations] public function testForget() { $array = ['products' => ['desk' => ['price' => 100]]]; @@ -1550,9 +1554,9 @@ public function testForget() Arr::forget($array, 'products.desk.final.taxes'); $this->assertEquals(['products' => ['desk' => ['price' => ['original' => 50, 'taxes' => 60]]]], $array); - $array = ['products' => ['desk' => ['price' => 50], '' => 'something']]; + $array = ['products' => ['desk' => ['price' => 50], null => 'something']]; Arr::forget($array, ['products.amount.all', 'products.desk.price']); - $this->assertEquals(['products' => ['desk' => [], '' => 'something']], $array); + $this->assertEquals(['products' => ['desk' => [], null => 'something']], $array); // Only works on first level keys $array = ['joe@example.com' => 'Joe', 'jane@example.com' => 'Jane']; From f859df101c88834f9a08d74bfa95d2520af493df Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:01:25 +0800 Subject: [PATCH 23/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/SupportArrTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index 9b5f7731b662..ea8a4eaa788f 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -1067,6 +1067,9 @@ public function testPrepend() $array = Arr::prepend(['one', 'two'], ['zero'], null); $this->assertEquals(['one', 'two', '' => ['zero']], $array); + + $array = Arr::prepend(['one', 'two', '' => 'three'], ['zero'], null); + $this->assertEquals(['one', 'two', '' => ['zero']], $array); } public function testPull() From 8f900684b7a47e4c11a9c045a43e50adb69d80d7 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:05:42 +0800 Subject: [PATCH 24/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/SupportCollectionTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 7438266c855c..43e57cc840a8 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -20,6 +20,7 @@ use JsonSerializable; use Mockery as m; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\IgnoreDeprecations; use PHPUnit\Framework\TestCase; use ReflectionClass; use stdClass; @@ -4215,6 +4216,7 @@ public function testPaginate($collection) $this->assertEquals([], $c->forPage(3, 2)->all()); } + #[IgnoreDeprecations] public function testPrepend() { $c = new Collection(['one', 'two', 'three', 'four']); From f24439063e57c363fcd045a1a0fe3c86a19791ed Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:07:33 +0800 Subject: [PATCH 25/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/SupportArrTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index ea8a4eaa788f..5c494c88a93b 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -1522,7 +1522,6 @@ public function testWhereKey() $this->assertEquals(['10' => 1, 20 => 2], $array); } - #[IgnoreDeprecations] public function testForget() { $array = ['products' => ['desk' => ['price' => 100]]]; @@ -1557,9 +1556,9 @@ public function testForget() Arr::forget($array, 'products.desk.final.taxes'); $this->assertEquals(['products' => ['desk' => ['price' => ['original' => 50, 'taxes' => 60]]]], $array); - $array = ['products' => ['desk' => ['price' => 50], null => 'something']]; + $array = ['products' => ['desk' => ['price' => 50], '' => 'something']]; Arr::forget($array, ['products.amount.all', 'products.desk.price']); - $this->assertEquals(['products' => ['desk' => [], null => 'something']], $array); + $this->assertEquals(['products' => ['desk' => [], '' => 'something']], $array); // Only works on first level keys $array = ['joe@example.com' => 'Joe', 'jane@example.com' => 'Jane']; From 0900b90fa04db8d7e6bf7862a5c25a20a001f962 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:10:43 +0800 Subject: [PATCH 26/31] wip Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Collections/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Collections/Collection.php b/src/Illuminate/Collections/Collection.php index 08a852fe19fa..8c0673e453fd 100644 --- a/src/Illuminate/Collections/Collection.php +++ b/src/Illuminate/Collections/Collection.php @@ -1033,7 +1033,7 @@ public function pop($count = 1) */ public function prepend($value, $key = null) { - $this->items = Arr::prepend($this->items, ...func_get_args()); + $this->items = Arr::prepend($this->items, ...(func_num_args() > 1 ? func_get_args() : [$value])); return $this; } From 951fa54a45c865bce62220629dd479496aad5d91 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:14:54 +0800 Subject: [PATCH 27/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Cache/RedisCacheIntegrationTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Cache/RedisCacheIntegrationTest.php b/tests/Cache/RedisCacheIntegrationTest.php index 76b1e3693cd2..55cf71a83948 100644 --- a/tests/Cache/RedisCacheIntegrationTest.php +++ b/tests/Cache/RedisCacheIntegrationTest.php @@ -20,10 +20,6 @@ class RedisCacheIntegrationTest extends TestCase protected function setUp(): void { - if (! class_exists(Redis::class)) { - $this->markTestSkipped('The Redis class/extension is not installed. Please install the extension to enable '.__CLASS__); - } - parent::setUp(); $this->setUpRedis(); } @@ -170,6 +166,10 @@ public function testItFailsWithAnInvalidPhpRedisAlgorithm() public static function phpRedisBackoffAlgorithmsProvider() { + if (! class_exists(Redis::class)) { + return []; + } + return [ ['default', Redis::BACKOFF_ALGORITHM_DEFAULT], ['decorrelated_jitter', Redis::BACKOFF_ALGORITHM_DECORRELATED_JITTER], From 1ee960c3d7a843ac6e0f5646b53ac9da6222c064 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:20:55 +0800 Subject: [PATCH 28/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/SupportCollectionTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 43e57cc840a8..fff1be0b7543 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -4236,6 +4236,12 @@ public function testPrepend() [null => 0, 'one' => 1, 'two' => 2], $c->prepend(0, null)->all() ); + + $c = new Collection(['one' => 1, 'two' => 2]); + $this->assertEquals( + [null => 0, 'one' => 1, 'two' => 2], + $c->prepend(0, '')->all() + ); } public function testPushWithOneItem() From c75e0116cbfb720280fd5db49531d417a40c06fa Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:23:14 +0800 Subject: [PATCH 29/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/SupportArrTest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index 5c494c88a93b..a090ebde9ca7 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -1065,11 +1065,17 @@ public function testPrepend() $array = Arr::prepend(['one', 'two'], ['zero'], 'key'); $this->assertEquals(['key' => ['zero'], 'one', 'two'], $array); - $array = Arr::prepend(['one', 'two'], ['zero'], null); + $array = Arr::prepend(['one', 'two'], ['zero'], ''); $this->assertEquals(['one', 'two', '' => ['zero']], $array); - $array = Arr::prepend(['one', 'two', '' => 'three'], ['zero'], null); + $array = Arr::prepend(['one', 'two', '' => 'three'], ['zero'], ''); $this->assertEquals(['one', 'two', '' => ['zero']], $array); + + $array = Arr::prepend(['one', 'two'], ['zero'], null); + $this->assertEquals(['one', 'two', null => ['zero']], $array); + + $array = Arr::prepend(['one', 'two', '' => 'three'], ['zero'], null); + $this->assertEquals(['one', 'two', null => ['zero']], $array); } public function testPull() From 6c4a276838180a88e889c996c7f14c8a7bf5c8b1 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:25:07 +0800 Subject: [PATCH 30/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/SupportArrTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index a090ebde9ca7..d47d2879614c 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -199,6 +199,11 @@ public function testDivide(): void $this->assertEquals([['one' => 1, 2 => 'second'], 'one'], $values); // Test dividing an array where the values are arrays + [$keys, $values] = Arr::divide(['' => ['one' => 1, 2 => 'second'], 1 => 'one']); + $this->assertEquals([null, 1], $keys); + $this->assertEquals([['one' => 1, 2 => 'second'], 'one'], $values); + + // Test dividing an array where the values are arrays (with null key) [$keys, $values] = Arr::divide([null => ['one' => 1, 2 => 'second'], 1 => 'one']); $this->assertEquals([null, 1], $keys); $this->assertEquals([['one' => 1, 2 => 'second'], 'one'], $values); @@ -1047,6 +1052,9 @@ public function testPrepend() $array = Arr::prepend(['one' => 1, 'two' => 2], 0, 'zero'); $this->assertEquals(['zero' => 0, 'one' => 1, 'two' => 2], $array); + $array = Arr::prepend(['one' => 1, 'two' => 2], 0, ''); + $this->assertEquals(['' => 0, 'one' => 1, 'two' => 2], $array); + $array = Arr::prepend(['one' => 1, 'two' => 2], 0, null); $this->assertEquals([null => 0, 'one' => 1, 'two' => 2], $array); From 08f872f04c104cfbc81a670409184cbbed5b97de Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 20 Nov 2025 16:30:54 +0800 Subject: [PATCH 31/31] wip Signed-off-by: Mior Muhammad Zaki --- tests/Cache/RedisCacheIntegrationTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Cache/RedisCacheIntegrationTest.php b/tests/Cache/RedisCacheIntegrationTest.php index 55cf71a83948..aafa46a0404d 100644 --- a/tests/Cache/RedisCacheIntegrationTest.php +++ b/tests/Cache/RedisCacheIntegrationTest.php @@ -11,9 +11,11 @@ use Illuminate\Support\Env; use InvalidArgumentException; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\TestCase; use Redis; +#[RequiresPhpExtension('redis')] class RedisCacheIntegrationTest extends TestCase { use InteractsWithRedis;