Skip to content

Commit

Permalink
Fixed _realpath() for UNC pathes like '\\examplepath\mypath' (will be…
Browse files Browse the repository at this point in the history
…come '//examplepath/mypath'). See #1.

Here is a comparison between the output of the old and new version of _realpath():

Input: '/a/b/c/' Output old: '/a/b/c/' Output new: '/a/b/c'
Input: '//a/b/c' Output old: '/a/b/c'  Output new: '//a/b/c'
Input: 'a//b'    Output old: 'a/b'     Output new: 'a//b'
  • Loading branch information
lpaulsen93 committed May 13, 2016
1 parent 64cebf9 commit ec30604
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,8 @@ function _realpath($path) {
$path=explode('/', $path);
$output=array();
for ($i=0; $i<sizeof($path); $i++) {
if (('' == $path[$i] && $i > 0) || '.' == $path[$i]) continue;
if ('..' == $path[$i] && $i > 0 && '..' != $output[sizeof($output) - 1]) {
if ('.' == $path[$i]) continue;
if ('..' == $path[$i] && '..' != $output[sizeof($output) - 1]) {
array_pop($output);
continue;
}
Expand Down

0 comments on commit ec30604

Please sign in to comment.