Skip to content

Commit d20bff9

Browse files
committed
fix: index maybe changed in method realpath
Signed-off-by: inhere <[email protected]>
1 parent eaf3883 commit d20bff9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Traits/FileSystemFuncTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Traversable;
1818
use function array_filter;
1919
use function array_pop;
20+
use function array_values;
2021
use function copy;
2122
use function error_get_last;
2223
use function function_exists;
@@ -166,7 +167,7 @@ public static function realpath(string $path): string
166167
{
167168
$path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
168169
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
169-
if (!$parts) {
170+
if (!$parts = array_values($parts)) {
170171
return '';
171172
}
172173

0 commit comments

Comments
 (0)