@ -413,8 +413,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return $this -> method === 'PUT'
&& $this -> getHeader ( 'Content-Length' ) !== '0'
&& $this -> getHeader ( 'Content-Length' ) !== ''
&& strpo s( $this -> getHeader ( 'Content-Type' ), 'application/x-www-form-urlencoded' ) === false
&& strpo s( $this -> getHeader ( 'Content-Type' ), 'application/json' ) === false ;
&& ! str_contain s( $this -> getHeader ( 'Content-Type' ), 'application/x-www-form-urlencoded' )
&& ! str_contain s( $this -> getHeader ( 'Content-Type' ), 'application/json' );
}
/**
@ -439,7 +439,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
// or post correctly
} elseif ( $this -> method !== 'GET'
&& $this -> method !== 'POST'
&& strpo s ( $this -> getHeader ( 'Content-Type' ), 'application/x-www-form-urlencoded' ) !== false ) {
&& str_contain s ( $this -> getHeader ( 'Content-Type' ), 'application/x-www-form-urlencoded' )) {
parse_str ( file_get_contents ( $this -> inputStream ), $params );
if ( \is_array ( $params )) {
$this -> items [ 'params' ] = $params ;
@ -603,7 +603,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
$IP = trim ( $IP );
// remove brackets from IPv6 addresses
if ( strpos ( $IP , '[' ) === 0 && substr ( $IP , - 1 ) === ']') {
if ( str_starts_with ( $IP , '[' ) && str_ends_with ( $IP , ']') ) {
$IP = substr ( $IP , 1 , - 1 );
}
@ -642,7 +642,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
if ( $this -> fromTrustedProxy () && isset ( $this -> server [ 'HTTP_X_FORWARDED_PROTO' ])) {
if ( strpo s ( $this -> server [ 'HTTP_X_FORWARDED_PROTO' ], ',' ) !== false ) {
if ( str_contain s ( $this -> server [ 'HTTP_X_FORWARDED_PROTO' ], ',' )) {
$parts = explode ( ',' , $this -> server [ 'HTTP_X_FORWARDED_PROTO' ]);
$proto = strtolower ( trim ( $parts [ 0 ]));
} else {
@ -724,7 +724,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
// FIXME: Sabre does not really belong here
[ $path , $name ] = \Sabre\Uri\split ( $scriptName );
if ( ! empty ( $path )) {
if ( $path === $pathInfo || strpos ( $pathInfo , $path . '/' ) === 0 ) {
if ( $path === $pathInfo || str_starts_with ( $pathInfo , $path . '/' )) {
$pathInfo = substr ( $pathInfo , \strlen ( $path ));
} else {
throw new \Exception ( " The requested uri( $requestUri ) cannot be processed by the script ' $scriptName ') " );
@ -734,10 +734,10 @@ class Request implements \ArrayAccess, \Countable, IRequest {
$name = '' ;
}
if ( strpos ( $pathInfo , '/' . $name ) === 0 ) {
if ( str_starts_with ( $pathInfo , '/' . $name )) {
$pathInfo = substr ( $pathInfo , \strlen ( $name ) + 1 );
}
if ( $name !== '' && strpos ( $pathInfo , $name ) === 0 ) {
if ( $name !== '' && str_starts_with ( $pathInfo , $name )) {
$pathInfo = substr ( $pathInfo , \strlen ( $name ));
}
if ( $pathInfo === false || $pathInfo === '/' ) {
@ -803,7 +803,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
$host = 'localhost' ;
if ( $this -> fromTrustedProxy () && isset ( $this -> server [ 'HTTP_X_FORWARDED_HOST' ])) {
if ( strpo s ( $this -> server [ 'HTTP_X_FORWARDED_HOST' ], ',' ) !== false ) {
if ( str_contain s ( $this -> server [ 'HTTP_X_FORWARDED_HOST' ], ',' )) {
$parts = explode ( ',' , $this -> server [ 'HTTP_X_FORWARDED_HOST' ]);
$host = trim ( current ( $parts ));
} else {