@@ -305,7 +305,7 @@ public static function createFromGlobals()
305
305
{
306
306
$ request = self ::createRequestFromFactory ($ _GET , $ _POST , [], $ _COOKIE , $ _FILES , $ _SERVER );
307
307
308
- if (0 === strpos ($ request ->headers ->get ('CONTENT_TYPE ' ), 'application/x-www-form-urlencoded ' )
308
+ if (0 === strpos ($ request ->headers ->get ('CONTENT_TYPE ' , '' ), 'application/x-www-form-urlencoded ' )
309
309
&& \in_array (strtoupper ($ request ->server ->get ('REQUEST_METHOD ' , 'GET ' )), ['PUT ' , 'DELETE ' , 'PATCH ' ])
310
310
) {
311
311
parse_str ($ request ->getContent (), $ data );
@@ -1404,7 +1404,7 @@ public function setRequestFormat(?string $format)
1404
1404
*/
1405
1405
public function getContentType ()
1406
1406
{
1407
- return $ this ->getFormat ($ this ->headers ->get ('CONTENT_TYPE ' ));
1407
+ return $ this ->getFormat ($ this ->headers ->get ('CONTENT_TYPE ' , '' ));
1408
1408
}
1409
1409
1410
1410
/**
@@ -1599,7 +1599,7 @@ public function toArray()
1599
1599
*/
1600
1600
public function getETags ()
1601
1601
{
1602
- return preg_split ('/\s*,\s*/ ' , $ this ->headers ->get ('if_none_match ' ), -1 , \PREG_SPLIT_NO_EMPTY );
1602
+ return preg_split ('/\s*,\s*/ ' , $ this ->headers ->get ('if_none_match ' , '' ), -1 , \PREG_SPLIT_NO_EMPTY );
1603
1603
}
1604
1604
1605
1605
/**
@@ -1848,13 +1848,13 @@ protected function prepareRequestUri()
1848
1848
*/
1849
1849
protected function prepareBaseUrl ()
1850
1850
{
1851
- $ filename = basename ($ this ->server ->get ('SCRIPT_FILENAME ' ));
1851
+ $ filename = basename ($ this ->server ->get ('SCRIPT_FILENAME ' , '' ));
1852
1852
1853
- if (basename ($ this ->server ->get ('SCRIPT_NAME ' )) === $ filename ) {
1853
+ if (basename ($ this ->server ->get ('SCRIPT_NAME ' , '' )) === $ filename ) {
1854
1854
$ baseUrl = $ this ->server ->get ('SCRIPT_NAME ' );
1855
- } elseif (basename ($ this ->server ->get ('PHP_SELF ' )) === $ filename ) {
1855
+ } elseif (basename ($ this ->server ->get ('PHP_SELF ' , '' )) === $ filename ) {
1856
1856
$ baseUrl = $ this ->server ->get ('PHP_SELF ' );
1857
- } elseif (basename ($ this ->server ->get ('ORIG_SCRIPT_NAME ' )) === $ filename ) {
1857
+ } elseif (basename ($ this ->server ->get ('ORIG_SCRIPT_NAME ' , '' )) === $ filename ) {
1858
1858
$ baseUrl = $ this ->server ->get ('ORIG_SCRIPT_NAME ' ); // 1and1 shared hosting compatibility
1859
1859
} else {
1860
1860
// Backtrack up the script_filename to find the portion matching
@@ -1894,7 +1894,7 @@ protected function prepareBaseUrl()
1894
1894
$ truncatedRequestUri = substr ($ requestUri , 0 , $ pos );
1895
1895
}
1896
1896
1897
- $ basename = basename ($ baseUrl );
1897
+ $ basename = basename ($ baseUrl ?? '' );
1898
1898
if (empty ($ basename ) || !strpos (rawurldecode ($ truncatedRequestUri ), $ basename )) {
1899
1899
// no match whatsoever; set it blank
1900
1900
return '' ;
@@ -2045,7 +2045,7 @@ private static function createRequestFromFactory(array $query = [], array $reque
2045
2045
*/
2046
2046
public function isFromTrustedProxy ()
2047
2047
{
2048
- return self ::$ trustedProxies && IpUtils::checkIp ($ this ->server ->get ('REMOTE_ADDR ' ), self ::$ trustedProxies );
2048
+ return self ::$ trustedProxies && IpUtils::checkIp ($ this ->server ->get ('REMOTE_ADDR ' , '' ), self ::$ trustedProxies );
2049
2049
}
2050
2050
2051
2051
private function getTrustedValues (int $ type , string $ ip = null ): array
0 commit comments