From 26f1d2f4e458782f61fc196b5b8fd0bbae17aa74 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 21 Dec 2023 08:53:31 -0600 Subject: [PATCH 1/5] + Added test that reproduces bug --- tests/Filesystem/JoinPathsHelperTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Filesystem/JoinPathsHelperTest.php b/tests/Filesystem/JoinPathsHelperTest.php index 2a4d7cf2e089..041af7754063 100644 --- a/tests/Filesystem/JoinPathsHelperTest.php +++ b/tests/Filesystem/JoinPathsHelperTest.php @@ -21,6 +21,7 @@ public static function unixDataProvider() { yield ['app/Http/Kernel.php', join_paths('app', 'Http', 'Kernel.php')]; yield ['app/Http/Kernel.php', join_paths('app', '', 'Http', 'Kernel.php')]; + yield ['app/Http/Kernel.php', join_paths('app', null, 'Http', 'Kernel.php')]; } #[RequiresOperatingSystem('Windows')] @@ -34,5 +35,6 @@ public static function windowsDataProvider() { yield ['app\Http\Kernel.php', join_paths('app', 'Http', 'Kernel.php')]; yield ['app\Http\Kernel.php', join_paths('app', '', 'Http', 'Kernel.php')]; + yield ['app\Http\Kernel.php', join_paths('app', null, 'Http', 'Kernel.php')]; } } From b9689c086e974039e52bf94901f18ccd9ab3114e Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 21 Dec 2023 08:55:20 -0600 Subject: [PATCH 2/5] + Added fix that resolves bug --- src/Illuminate/Filesystem/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Filesystem/functions.php b/src/Illuminate/Filesystem/functions.php index 47a26fd5eb38..a84dfb603c49 100644 --- a/src/Illuminate/Filesystem/functions.php +++ b/src/Illuminate/Filesystem/functions.php @@ -7,10 +7,10 @@ * Join the given paths together. * * @param string|null $basePath - * @param string ...$paths + * @param string|null ...$paths * @return string */ - function join_paths($basePath, string ...$paths) + function join_paths($basePath, ?string ...$paths) { foreach ($paths as $index => $path) { if (empty($path)) { From 0a1456f208545598357db94dd5f2bec4756d35f0 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 21 Dec 2023 09:08:49 -0600 Subject: [PATCH 3/5] Update src/Illuminate/Filesystem/functions.php Co-authored-by: Mior Muhammad Zaki --- src/Illuminate/Filesystem/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Filesystem/functions.php b/src/Illuminate/Filesystem/functions.php index a84dfb603c49..6ce25f632b93 100644 --- a/src/Illuminate/Filesystem/functions.php +++ b/src/Illuminate/Filesystem/functions.php @@ -7,7 +7,7 @@ * Join the given paths together. * * @param string|null $basePath - * @param string|null ...$paths + * @param string ...$paths * @return string */ function join_paths($basePath, ?string ...$paths) From 5efb95361668a61db8ce612cabca16e28816d9c1 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 21 Dec 2023 09:08:55 -0600 Subject: [PATCH 4/5] Update src/Illuminate/Filesystem/functions.php Co-authored-by: Mior Muhammad Zaki --- src/Illuminate/Filesystem/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Filesystem/functions.php b/src/Illuminate/Filesystem/functions.php index 6ce25f632b93..af39716f6e4f 100644 --- a/src/Illuminate/Filesystem/functions.php +++ b/src/Illuminate/Filesystem/functions.php @@ -10,7 +10,7 @@ * @param string ...$paths * @return string */ - function join_paths($basePath, ?string ...$paths) + function join_paths($basePath, ...$paths) { foreach ($paths as $index => $path) { if (empty($path)) { From 5178c97f8f7254058cb72fdd9cb952ecc1299459 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 21 Dec 2023 09:16:49 -0600 Subject: [PATCH 5/5] ~ Don't explicitly test for null --- tests/Filesystem/JoinPathsHelperTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Filesystem/JoinPathsHelperTest.php b/tests/Filesystem/JoinPathsHelperTest.php index 041af7754063..2a4d7cf2e089 100644 --- a/tests/Filesystem/JoinPathsHelperTest.php +++ b/tests/Filesystem/JoinPathsHelperTest.php @@ -21,7 +21,6 @@ public static function unixDataProvider() { yield ['app/Http/Kernel.php', join_paths('app', 'Http', 'Kernel.php')]; yield ['app/Http/Kernel.php', join_paths('app', '', 'Http', 'Kernel.php')]; - yield ['app/Http/Kernel.php', join_paths('app', null, 'Http', 'Kernel.php')]; } #[RequiresOperatingSystem('Windows')] @@ -35,6 +34,5 @@ public static function windowsDataProvider() { yield ['app\Http\Kernel.php', join_paths('app', 'Http', 'Kernel.php')]; yield ['app\Http\Kernel.php', join_paths('app', '', 'Http', 'Kernel.php')]; - yield ['app\Http\Kernel.php', join_paths('app', null, 'Http', 'Kernel.php')]; } }