From 2a3b762aa2d49ad57b35245d98b778559aea2cf1 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 24 Nov 2015 13:54:04 +0300 Subject: [PATCH] Fix. `path_join` function when first argument is full path. --- secure/fax_to_email.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index 2ca26ee3c1..6a184b001a 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -72,9 +72,22 @@ if(!function_exists('path_join')) { $paths = array_merge($paths, (array)$arg); } - $paths = array_map(create_function('$p', 'return trim($p, "/");'), $paths); + $prefix = null; + foreach($paths as &$path) { + if($prefix === null && strlen($path) > 0) { + if(substr($path, 0, 1) == '/') $prefix = '/'; + else $prefix = ''; + } + $path = trim( $path, '/' ); + } + + if($prefix === null){ + return ''; + } + $paths = array_filter($paths); - return join('/', $paths); + + return $prefix . join('/', $paths); } }