Skip to content

Commit 7d8c945

Browse files
committed
replace invalid filesystem dependent DIRECTORY_SEPARATOR references in uri mechanics by forward slashes
- fixes failing UriResolver tests on windows systems
1 parent d97cf3c commit 7d8c945

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/JsonSchema/Uri/UriResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static function combineRelativePathWithBasePath($relativePath, $basePath)
126126
$basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
127127
$path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
128128

129-
return implode(DIRECTORY_SEPARATOR, $basePathSegments) . '/' . $path;
129+
return implode('/', $basePathSegments) . '/' . $path;
130130
}
131131

132132
/**
@@ -148,7 +148,7 @@ private static function normalizePath($path)
148148
*/
149149
private static function getPathSegments($path) {
150150

151-
return explode(DIRECTORY_SEPARATOR, $path);
151+
return explode('/', $path);
152152
}
153153

154154
/**

src/JsonSchema/Uri/UriRetriever.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ private static function combineRelativePathWithBasePath($relativePath, $basePath
282282
$basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
283283
$path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
284284

285-
return implode(DIRECTORY_SEPARATOR, $basePathSegments) . '/' . $path;
285+
return implode('/', $basePathSegments) . '/' . $path;
286286
}
287287

288288
/**
@@ -304,7 +304,7 @@ private static function normalizePath($path)
304304
*/
305305
private static function getPathSegments($path)
306306
{
307-
return explode(DIRECTORY_SEPARATOR, $path);
307+
return explode('/', $path);
308308
}
309309

310310
/**

0 commit comments

Comments
 (0)