@@ -1850,6 +1850,62 @@ public static function getBaseUrlData()
1850
1850
];
1851
1851
}
1852
1852
1853
+ /**
1854
+ * @dataProvider baseUriDetectionOnIisWithRewriteData
1855
+ */
1856
+ public function testBaseUriDetectionOnIisWithRewrite (array $ server , string $ expectedBaseUrl , string $ expectedPathInfo )
1857
+ {
1858
+ $ request = new Request ([], [], [], [], [], $ server );
1859
+
1860
+ self ::assertSame ($ expectedBaseUrl , $ request ->getBaseUrl ());
1861
+ self ::assertSame ($ expectedPathInfo , $ request ->getPathInfo ());
1862
+ }
1863
+
1864
+ public static function baseUriDetectionOnIisWithRewriteData (): \Generator
1865
+ {
1866
+ yield 'No rewrite ' => [
1867
+ [
1868
+ 'PATH_INFO ' => '/foo/bar ' ,
1869
+ 'PHP_SELF ' => '/routingtest/index.php/foo/bar ' ,
1870
+ 'REQUEST_URI ' => '/routingtest/index.php/foo/bar ' ,
1871
+ 'SCRIPT_FILENAME ' => 'C:/Users/derrabus/Projects/routing-test/public/index.php ' ,
1872
+ 'SCRIPT_NAME ' => '/routingtest/index.php ' ,
1873
+ ],
1874
+ '/routingtest/index.php ' ,
1875
+ '/foo/bar ' ,
1876
+ ];
1877
+
1878
+ yield 'Rewrite with correct case ' => [
1879
+ [
1880
+ 'IIS_WasUrlRewritten ' => '1 ' ,
1881
+ 'PATH_INFO ' => '/foo/bar ' ,
1882
+ 'PHP_SELF ' => '/routingtest/index.php/foo/bar ' ,
1883
+ 'REQUEST_URI ' => '/routingtest/foo/bar ' ,
1884
+ 'SCRIPT_FILENAME ' => 'C:/Users/derrabus/Projects/routing-test/public/index.php ' ,
1885
+ 'SCRIPT_NAME ' => '/routingtest/index.php ' ,
1886
+ 'UNENCODED_URL ' => '/routingtest/foo/bar ' ,
1887
+ ],
1888
+ '/routingtest ' ,
1889
+ '/foo/bar ' ,
1890
+ ];
1891
+
1892
+ // ISS with UrlRewriteModule might report SCRIPT_NAME/PHP_SELF with wrong case
1893
+ // see https://github.com/php/php-src/issues/11981
1894
+ yield 'Rewrite with case mismatch ' => [
1895
+ [
1896
+ 'IIS_WasUrlRewritten ' => '1 ' ,
1897
+ 'PATH_INFO ' => '/foo/bar ' ,
1898
+ 'PHP_SELF ' => '/routingtest/index.php/foo/bar ' ,
1899
+ 'REQUEST_URI ' => '/RoutingTest/foo/bar ' ,
1900
+ 'SCRIPT_FILENAME ' => 'C:/Users/derrabus/Projects/routing-test/public/index.php ' ,
1901
+ 'SCRIPT_NAME ' => '/routingtest/index.php ' ,
1902
+ 'UNENCODED_URL ' => '/RoutingTest/foo/bar ' ,
1903
+ ],
1904
+ '/RoutingTest ' ,
1905
+ '/foo/bar ' ,
1906
+ ];
1907
+ }
1908
+
1853
1909
/**
1854
1910
* @dataProvider urlencodedStringPrefixData
1855
1911
*/
0 commit comments