@@ -292,7 +292,7 @@ public static function createFromGlobals()
292
292
{
293
293
$ request = self ::createRequestFromFactory ($ _GET , $ _POST , [], $ _COOKIE , $ _FILES , $ _SERVER );
294
294
295
- if (0 === strpos ($ request ->headers ->get ('CONTENT_TYPE ' ), 'application/x-www-form-urlencoded ' )
295
+ if (0 === strpos ($ request ->headers ->get ('CONTENT_TYPE ' , '' ), 'application/x-www-form-urlencoded ' )
296
296
&& \in_array (strtoupper ($ request ->server ->get ('REQUEST_METHOD ' , 'GET ' )), ['PUT ' , 'DELETE ' , 'PATCH ' ])
297
297
) {
298
298
parse_str ($ request ->getContent (), $ data );
@@ -1391,7 +1391,7 @@ public function setRequestFormat($format)
1391
1391
*/
1392
1392
public function getContentType ()
1393
1393
{
1394
- return $ this ->getFormat ($ this ->headers ->get ('CONTENT_TYPE ' ));
1394
+ return $ this ->getFormat ($ this ->headers ->get ('CONTENT_TYPE ' , '' ));
1395
1395
}
1396
1396
1397
1397
/**
@@ -1564,7 +1564,7 @@ public function getContent($asResource = false)
1564
1564
*/
1565
1565
public function getETags ()
1566
1566
{
1567
- return preg_split ('/\s*,\s*/ ' , $ this ->headers ->get ('if_none_match ' ), -1 , \PREG_SPLIT_NO_EMPTY );
1567
+ return preg_split ('/\s*,\s*/ ' , $ this ->headers ->get ('if_none_match ' , '' ), -1 , \PREG_SPLIT_NO_EMPTY );
1568
1568
}
1569
1569
1570
1570
/**
@@ -1790,13 +1790,13 @@ protected function prepareRequestUri()
1790
1790
*/
1791
1791
protected function prepareBaseUrl ()
1792
1792
{
1793
- $ filename = basename ($ this ->server ->get ('SCRIPT_FILENAME ' ));
1793
+ $ filename = basename ($ this ->server ->get ('SCRIPT_FILENAME ' , '' ));
1794
1794
1795
- if (basename ($ this ->server ->get ('SCRIPT_NAME ' )) === $ filename ) {
1795
+ if (basename ($ this ->server ->get ('SCRIPT_NAME ' , '' )) === $ filename ) {
1796
1796
$ baseUrl = $ this ->server ->get ('SCRIPT_NAME ' );
1797
- } elseif (basename ($ this ->server ->get ('PHP_SELF ' )) === $ filename ) {
1797
+ } elseif (basename ($ this ->server ->get ('PHP_SELF ' , '' )) === $ filename ) {
1798
1798
$ baseUrl = $ this ->server ->get ('PHP_SELF ' );
1799
- } elseif (basename ($ this ->server ->get ('ORIG_SCRIPT_NAME ' )) === $ filename ) {
1799
+ } elseif (basename ($ this ->server ->get ('ORIG_SCRIPT_NAME ' , '' )) === $ filename ) {
1800
1800
$ baseUrl = $ this ->server ->get ('ORIG_SCRIPT_NAME ' ); // 1and1 shared hosting compatibility
1801
1801
} else {
1802
1802
// Backtrack up the script_filename to find the portion matching
@@ -1836,7 +1836,7 @@ protected function prepareBaseUrl()
1836
1836
$ truncatedRequestUri = substr ($ requestUri , 0 , $ pos );
1837
1837
}
1838
1838
1839
- $ basename = basename ($ baseUrl );
1839
+ $ basename = basename ($ baseUrl ?? '' );
1840
1840
if (empty ($ basename ) || !strpos (rawurldecode ($ truncatedRequestUri ), $ basename )) {
1841
1841
// no match whatsoever; set it blank
1842
1842
return '' ;
@@ -1987,7 +1987,7 @@ private static function createRequestFromFactory(array $query = [], array $reque
1987
1987
*/
1988
1988
public function isFromTrustedProxy ()
1989
1989
{
1990
- return self ::$ trustedProxies && IpUtils::checkIp ($ this ->server ->get ('REMOTE_ADDR ' ), self ::$ trustedProxies );
1990
+ return self ::$ trustedProxies && IpUtils::checkIp ($ this ->server ->get ('REMOTE_ADDR ' , '' ), self ::$ trustedProxies );
1991
1991
}
1992
1992
1993
1993
private function getTrustedValues (int $ type , string $ ip = null ): array
0 commit comments