Skip to content

Commit 84c7dc1

Browse files
committed
better basePath support
1 parent a489e7b commit 84c7dc1

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

api.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4812,14 +4812,11 @@ private function detectBasePath(string $basePath): string
48124812
if (isset($_SERVER['PATH_INFO'])) {
48134813
$fullPath = explode('?', $_SERVER['REQUEST_URI'])[0];
48144814
$path = $_SERVER['PATH_INFO'];
4815-
if (!$path) {
4816-
return $_SERVER['PHP_SELF'];
4817-
}
48184815
if (substr($fullPath, -1 * strlen($path)) == $path) {
48194816
return substr($fullPath, 0, -1 * strlen($path));
48204817
}
48214818
}
4822-
return '/';
4819+
return $_SERVER['PHP_SELF'];
48234820
}
48244821

48254822
private function loadPathTree(): PathTree

src/Tqdev/PhpCrudApi/Middleware/Router/SimpleRouter.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,11 @@ private function detectBasePath(string $basePath): string
4444
if (isset($_SERVER['PATH_INFO'])) {
4545
$fullPath = explode('?', $_SERVER['REQUEST_URI'])[0];
4646
$path = $_SERVER['PATH_INFO'];
47-
if (!$path) {
48-
return $_SERVER['PHP_SELF'];
49-
}
5047
if (substr($fullPath, -1 * strlen($path)) == $path) {
5148
return substr($fullPath, 0, -1 * strlen($path));
5249
}
5350
}
54-
return '/';
51+
return $_SERVER['PHP_SELF'];
5552
}
5653

5754
private function loadPathTree(): PathTree

0 commit comments

Comments
 (0)