From 3f34eebbe2e6585167227e3cc88d7ac403d00972 Mon Sep 17 00:00:00 2001 From: Camwyn Date: Wed, 30 Nov 2022 16:21:51 -0500 Subject: [PATCH 1/2] Fix bad pathing creating double-slashes. run `array_filter()` (without a second param - so it jsut removes empty items) on $path before we run `implode()` Part of [ECP-1400] When we implode the $path arrays, ensure we first remove all empty items or we wind up with things like `/site/tec/dev/themes/twentytwenty//tribe/events-pro//custom-tables-v1` instead of `/site/tec/dev/themes/twentytwenty/tribe/events-pro/custom-tables-v1` :movie_camera: https://d.pr/v/ihcOLc --- src/Tribe/Template.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tribe/Template.php b/src/Tribe/Template.php index c752eacd19..eec210a60c 100644 --- a/src/Tribe/Template.php +++ b/src/Tribe/Template.php @@ -416,7 +416,7 @@ protected function get_template_plugin_path() { $path = array_merge( (array) $this->template_base_path, $this->folder ); // Implode to avoid Window Problems - $path = implode( DIRECTORY_SEPARATOR, $path ); + $path = implode( DIRECTORY_SEPARATOR, array_filter( $path ) ); /** * Allows filtering of the base path for templates @@ -505,7 +505,7 @@ protected function get_template_public_path( $base, $namespace ) { } // Implode to avoid Window Problems - $path = implode( DIRECTORY_SEPARATOR, $path ); + $path = implode( DIRECTORY_SEPARATOR, array_filter( $path ) ); /** * Allows filtering of the base path for templates @@ -649,7 +649,7 @@ public function get_template_file( $name ) { } // Build the File Path - $file = implode( DIRECTORY_SEPARATOR, array_merge( (array) $folder['path'], $name ) ); + $file = implode( DIRECTORY_SEPARATOR, array_filter( array_merge( (array) $folder['path'], $name ) ) ); // Append the Extension to the file path $file .= '.php'; @@ -1149,7 +1149,7 @@ protected function get_template_common_path() { $path = array_merge( (array) $common_abs_path, $this->folder ); // Implode to avoid problems on Windows hosts. - $path = implode( DIRECTORY_SEPARATOR, $path ); + $path = implode( DIRECTORY_SEPARATOR, array_filter( $path ) ); /** * Allows filtering the path to a template provided by Common. From 58bf1aabe36b013a7f3932c18423306a1c71393f Mon Sep 17 00:00:00 2001 From: Camwyn Date: Wed, 30 Nov 2022 16:50:06 -0500 Subject: [PATCH 2/2] changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 5250731554..a6d47e1122 100644 --- a/readme.txt +++ b/readme.txt @@ -3,6 +3,7 @@ = [TBD] TBD = * Fix - Ensure the `clear country` icon resets the value as expect in the create/edit venue page. [TEC-4393] +* Fix - Correct and issue where template paths would contain double-slashes `\\` due to empty entries in the paths array. [ECP-1400] = [5.0.4] 2022-11-29 =