File tree Expand file tree Collapse file tree 2 files changed +23
-12
lines changed
src/Tqdev/PhpCrudApi/Middleware/Router Expand file tree Collapse file tree 2 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -4809,14 +4809,20 @@ private function detectBasePath(string $basePath): string
4809
4809
if ($ basePath ) {
4810
4810
return $ basePath ;
4811
4811
}
4812
- if (isset ($ _SERVER ['PATH_INFO ' ])) {
4812
+ if (isset ($ _SERVER ['REQUEST_URI ' ])) {
4813
4813
$ fullPath = explode ('? ' , $ _SERVER ['REQUEST_URI ' ])[0 ];
4814
- $ path = $ _SERVER ['PATH_INFO ' ];
4815
- if (substr ($ fullPath , -1 * strlen ($ path )) == $ path ) {
4816
- return substr ($ fullPath , 0 , -1 * strlen ($ path ));
4814
+ if (isset ($ _SERVER ['PATH_INFO ' ])) {
4815
+ $ path = $ _SERVER ['PATH_INFO ' ];
4816
+ if (!$ path ) {
4817
+ return $ _SERVER ['PHP_SELF ' ];
4818
+ }
4819
+ if (substr ($ fullPath , -1 * strlen ($ path )) == $ path ) {
4820
+ return substr ($ fullPath , 0 , -1 * strlen ($ path ));
4821
+ }
4817
4822
}
4823
+ return $ fullPath ;
4818
4824
}
4819
- return $ _SERVER [ ' PHP_SELF ' ] ;
4825
+ return ' / ' ;
4820
4826
}
4821
4827
4822
4828
private function loadPathTree (): PathTree
Original file line number Diff line number Diff line change @@ -41,15 +41,20 @@ private function detectBasePath(string $basePath): string
41
41
if ($ basePath ) {
42
42
return $ basePath ;
43
43
}
44
- $ fullPath = explode ('? ' , $ _SERVER ['REQUEST_URI ' ])[0 ];
45
- $ path = $ _SERVER ['PATH_INFO ' ];
46
- if (!$ path ) {
44
+ if (isset ($ _SERVER ['REQUEST_URI ' ])) {
45
+ $ fullPath = explode ('? ' , $ _SERVER ['REQUEST_URI ' ])[0 ];
46
+ if (isset ($ _SERVER ['PATH_INFO ' ])) {
47
+ $ path = $ _SERVER ['PATH_INFO ' ];
48
+ if (!$ path ) {
49
+ return $ _SERVER ['PHP_SELF ' ];
50
+ }
51
+ if (substr ($ fullPath , -1 * strlen ($ path )) == $ path ) {
52
+ return substr ($ fullPath , 0 , -1 * strlen ($ path ));
53
+ }
54
+ }
47
55
return $ fullPath ;
48
56
}
49
- if (substr ($ fullPath , -1 * strlen ($ path )) == $ path ) {
50
- return substr ($ fullPath , 0 , -1 * strlen ($ path ));
51
- }
52
- return $ _SERVER ['PHP_SELF ' ];
57
+ return '/ ' ;
53
58
}
54
59
55
60
private function loadPathTree (): PathTree
You can’t perform that action at this time.
0 commit comments