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