added an additional filter to remove empty array items (#10803)

* ENH Added filter to remove empty/null from Path::join parts

This is to ensure null values are removed and trim() deprecated warnings are not thrown
Fixes #10802

* FIX revert public signature

Co-authored-by: Steve Boyd <emteknetnz@gmail.com>

---------

Co-authored-by: Steve Boyd <emteknetnz@gmail.com>
This commit is contained in:
josephlewisnz 2023-06-14 15:46:23 +12:00 committed by GitHub
parent 6fd7694cbc
commit b6a3e3a951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ class Path
} }
// Cleanup and join all parts // Cleanup and join all parts
$parts = array_filter(array_map('trim', $parts ?? [])); $parts = array_filter(array_map('trim', array_filter($parts ?? [])));
$fullPath = static::normalise(implode(DIRECTORY_SEPARATOR, $parts)); $fullPath = static::normalise(implode(DIRECTORY_SEPARATOR, $parts));
// Protect against directory traversal vulnerability (OTG-AUTHZ-001) // Protect against directory traversal vulnerability (OTG-AUTHZ-001)