Skip to content

Commit

Permalink
Fix. path_join function when first argument is full path.
Browse files Browse the repository at this point in the history
  • Loading branch information
moteus committed Nov 24, 2015
1 parent 3d643bb commit 573738f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions secure/fax_to_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,22 @@ function 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);
}
}

Expand Down

0 comments on commit 573738f

Please sign in to comment.