Browse code

basePath fix for multiple trailing slashes

RafaƂ Szklarczyk authored on 26/08/2024 11:48:29
Showing 1 changed files
... ...
@@ -48,8 +48,7 @@ class Application{
48 48
     public function basePath(){
49 49
         if(isset($this->request->path)&&$this->request->path!=''){
50 50
             $base = explode('%23',explode('?',$_SERVER['REQUEST_URI'],2)[0],2)[0];
51
-            if (substr($base,-strlen($this->request->path))===$this->request->path) $base = substr($base, 0, strlen($base)-strlen($this->request->path));
52
-            return $base;
51
+            return strstr($base, $this->request->path, true);
53 52
         }
54 53
         else
55 54
             return explode('%23',explode('?',$_SERVER['REQUEST_URI'],2)[0],2)[0];