File tree 2 files changed +38
-4
lines changed
src/Symfony/Component/HttpFoundation
2 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -1944,10 +1944,14 @@ protected function prepareBaseUrl()
1944
1944
$ truncatedRequestUri = substr ($ requestUri , 0 , $ pos );
1945
1945
}
1946
1946
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
+ }
1951
1955
}
1952
1956
1953
1957
// 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()
1740
1740
'/foo ' ,
1741
1741
'/bar+baz ' ,
1742
1742
],
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
+ ],
1743
1773
];
1744
1774
}
1745
1775
You can’t perform that action at this time.
0 commit comments