Skip to content

Commit

Permalink
fix slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Feb 9, 2016
1 parent 79ebe17 commit 73b7826
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ protected static function _linkifyRegex($text)
*/
public static function pathToRel($path)
{
$root = Vars::get($_SERVER['DOCUMENT_ROOT']);
$root = FS::clean($root);
$root = FS::clean(Vars::get($_SERVER['DOCUMENT_ROOT']));
$path = FS::clean($path);

$normRoot = str_replace(DIRECTORY_SEPARATOR, '/', $root);
$normPath = str_replace(DIRECTORY_SEPARATOR, '/', $path);
Expand Down
4 changes: 4 additions & 0 deletions tests/UrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,9 @@ public function testPathToUrl()

isSame('tests/UrlTest.php', Url::pathToRel(__FILE__));
isSame('http://test.dev/tests/UrlTest.php', Url::pathToUrl(__FILE__));

$_SERVER['DOCUMENT_ROOT'] = str_replace('/', '\\', PROJECT_ROOT);
isSame('tests/UrlTest.php', Url::pathToRel(__FILE__));
isSame('http://test.dev/tests/UrlTest.php', Url::pathToUrl(__FILE__));
}
}

0 comments on commit 73b7826

Please sign in to comment.