From 27963429a1d1a5f29e0bb7709bc2d49477323acb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 2 Jun 2022 15:29:26 +0000 Subject: [PATCH] General: Remove redundant `ltrim()` from `path_join()`. If the path starts with a slash, it will be considered absolute and returned as is earlier in the function. It it's not absolute, then it does not start with a slash, so there is nothing to trim. This change is covered by existing unit tests. Follow-up to [6984], [53457]. Props karlijnbk. See #55897. git-svn-id: https://develop.svn.wordpress.org/trunk@53460 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index b73e97a932..4ecad8e808 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -2132,7 +2132,7 @@ function path_join( $base, $path ) { return $path; } - return rtrim( $base, '/' ) . '/' . ltrim( $path, '/' ); + return rtrim( $base, '/' ) . '/' . $path; } /**