File tree Expand file tree Collapse file tree 2 files changed +38
-4
lines changed
src/Symfony/Component/HttpFoundation Expand file tree Collapse file tree 2 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -1944,10 +1944,14 @@ protected function prepareBaseUrl()
19441944 $ truncatedRequestUri = substr ($ requestUri , 0 , $ pos );
19451945 }
19461946
1947- $ basename = basename ($ baseUrl );
1948- if (empty ($ basename ) || !strpos (rawurldecode ($ truncatedRequestUri ), $ basename )) {
1949- // no match whatsoever; set it blank
1950- return '' ;
1947+ if (empty (basename ($ baseUrl )) || !strpos (rawurldecode ($ truncatedRequestUri ), basename ($ baseUrl ))) {
1948+ // strip autoindex filename, for virtualhost based on URL path
1949+ $ baseUrl = \dirname ($ baseUrl ).'/ ' ;
1950+
1951+ if (empty (basename ($ baseUrl )) || !strpos (rawurldecode ($ truncatedRequestUri ), basename ($ baseUrl ))) {
1952+ // no match whatsoever; set it blank
1953+ return '' ;
1954+ }
19511955 }
19521956
19531957 // If using mod_rewrite or ISAPI_Rewrite strip the script filename
Original file line number Diff line number Diff line change @@ -1740,6 +1740,36 @@ public function getBaseUrlData()
17401740 '/foo ' ,
17411741 '/bar+baz ' ,
17421742 ],
1743+ [
1744+ '/sub/foo/bar ' ,
1745+ [
1746+ 'SCRIPT_FILENAME ' => '/home/John Doe/public_html/foo/app.php ' ,
1747+ 'SCRIPT_NAME ' => '/foo/app.php ' ,
1748+ 'PHP_SELF ' => '/foo/app.php ' ,
1749+ ],
1750+ '/sub/foo ' ,
1751+ '/bar ' ,
1752+ ],
1753+ [
1754+ '/sub/foo/app.php/bar ' ,
1755+ [
1756+ 'SCRIPT_FILENAME ' => '/home/John Doe/public_html/foo/app.php ' ,
1757+ 'SCRIPT_NAME ' => '/foo/app.php ' ,
1758+ 'PHP_SELF ' => '/foo/app.php ' ,
1759+ ],
1760+ '/sub/foo/app.php ' ,
1761+ '/bar ' ,
1762+ ],
1763+ [
1764+ '/sub/foo/bar/baz ' ,
1765+ [
1766+ 'SCRIPT_FILENAME ' => '/home/John Doe/public_html/foo/app2.phpx ' ,
1767+ 'SCRIPT_NAME ' => '/foo/app2.phpx ' ,
1768+ 'PHP_SELF ' => '/foo/app2.phpx ' ,
1769+ ],
1770+ '/sub/foo ' ,
1771+ '/bar/baz ' ,
1772+ ],
17431773 ];
17441774 }
17451775
You can’t perform that action at this time.
0 commit comments