composer update

This commit is contained in:
Oliver Davies 2019-01-24 08:00:03 +00:00
parent f6abc3dce2
commit 71dfaca858
1753 changed files with 45274 additions and 14619 deletions

View file

@ -101,9 +101,9 @@ class HeaderBag implements \IteratorAggregate, \Countable
/**
* Returns a header value by name.
*
* @param string $key The header name
* @param string|string[]|null $default The default value
* @param bool $first Whether to return the first value or all header values
* @param string $key The header name
* @param string|null $default The default value
* @param bool $first Whether to return the first value or all header values
*
* @return string|string[]|null The first header value or default value if $first is true, an array of values otherwise
*/

View file

@ -1,4 +1,4 @@
Copyright (c) 2004-2018 Fabien Potencier
Copyright (c) 2004-2019 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -174,7 +174,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
* Returns the parameter value converted to boolean.
*
* @param string $key The parameter key
* @param mixed $default The default value if the parameter key does not exist
* @param bool $default The default value if the parameter key does not exist
*
* @return bool The filtered value
*/

View file

@ -1419,7 +1419,7 @@ class Request
{
$canonicalMimeType = null;
if (false !== $pos = strpos($mimeType, ';')) {
$canonicalMimeType = substr($mimeType, 0, $pos);
$canonicalMimeType = trim(substr($mimeType, 0, $pos));
}
if (null === static::$formats) {
@ -1586,7 +1586,7 @@ class Request
*
* @see https://tools.ietf.org/html/rfc7231#section-4.2.3
*
* @return bool
* @return bool True for GET and HEAD, false otherwise
*/
public function isMethodCacheable()
{
@ -1836,10 +1836,24 @@ class Request
$this->server->remove('IIS_WasUrlRewritten');
} elseif ($this->server->has('REQUEST_URI')) {
$requestUri = $this->server->get('REQUEST_URI');
// HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, only use URL path
$schemeAndHttpHost = $this->getSchemeAndHttpHost();
if (0 === strpos($requestUri, $schemeAndHttpHost)) {
$requestUri = substr($requestUri, \strlen($schemeAndHttpHost));
if ('' !== $requestUri && '/' === $requestUri[0]) {
// To only use path and query remove the fragment.
if (false !== $pos = strpos($requestUri, '#')) {
$requestUri = substr($requestUri, 0, $pos);
}
} else {
// HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path,
// only use URL path.
$uriComponents = parse_url($requestUri);
if (isset($uriComponents['path'])) {
$requestUri = $uriComponents['path'];
}
if (isset($uriComponents['query'])) {
$requestUri .= '?'.$uriComponents['query'];
}
}
} elseif ($this->server->has('ORIG_PATH_INFO')) {
// IIS 5.0, PHP as CGI

View file

@ -334,8 +334,9 @@ class Response
// headers
foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
$replace = 0 === strcasecmp($name, 'Content-Type');
foreach ($values as $value) {
header($name.': '.$value, false, $this->statusCode);
header($name.': '.$value, $replace, $this->statusCode);
}
}

View file

@ -131,7 +131,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
if (\PHP_VERSION_ID < 70000) {
$this->prefetchData = null;
}
if (!headers_sent() && ini_get('session.use_cookies')) {
if (!headers_sent() && filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN)) {
if (!$this->sessionName) {
throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', \get_class($this)));
}
@ -159,7 +159,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
header($h, false);
}
} else {
setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly'));
setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), filter_var(ini_get('session.cookie_secure'), FILTER_VALIDATE_BOOLEAN), filter_var(ini_get('session.cookie_httponly'), FILTER_VALIDATE_BOOLEAN));
}
}

View file

@ -637,7 +637,7 @@ class PdoSessionHandler extends AbstractSessionHandler
throw new \RuntimeException('Failed to read session: INSERT reported a duplicate id but next SELECT did not return any data.');
}
if (!ini_get('session.use_strict_mode') && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) {
if (!filter_var(ini_get('session.use_strict_mode'), FILTER_VALIDATE_BOOLEAN) && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) {
// In strict mode, session fixation is not possible: new sessions always start with a unique
// random id, so that concurrency is not possible and this code path can be skipped.
// Exclusive-reading of non-existent rows does not block, so we need to do an insert to block

View file

@ -137,7 +137,7 @@ class NativeSessionStorage implements SessionStorageInterface
throw new \RuntimeException('Failed to start the session: already started by PHP.');
}
if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
if (filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) {
throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
}

View file

@ -22,7 +22,7 @@ error_reporting(-1);
ini_set('html_errors', 0);
ini_set('display_errors', 1);
if (ini_get('xdebug.default_enable')) {
if (filter_var(ini_get('xdebug.default_enable'), FILTER_VALIDATE_BOOLEAN)) {
xdebug_disable();
}

View file

@ -232,6 +232,104 @@ class RequestTest extends TestCase
$this->assertEquals(80, $request->getPort());
$this->assertEquals('test.com', $request->getHttpHost());
$this->assertFalse($request->isSecure());
// Fragment should not be included in the URI
$request = Request::create('http://test.com/foo#bar');
$this->assertEquals('http://test.com/foo', $request->getUri());
}
public function testCreateWithRequestUri()
{
$request = Request::create('http://test.com:80/foo');
$request->server->set('REQUEST_URI', 'http://test.com:80/foo');
$this->assertEquals('http://test.com/foo', $request->getUri());
$this->assertEquals('/foo', $request->getPathInfo());
$this->assertEquals('test.com', $request->getHost());
$this->assertEquals('test.com', $request->getHttpHost());
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
$request = Request::create('http://test.com:8080/foo');
$request->server->set('REQUEST_URI', 'http://test.com:8080/foo');
$this->assertEquals('http://test.com:8080/foo', $request->getUri());
$this->assertEquals('/foo', $request->getPathInfo());
$this->assertEquals('test.com', $request->getHost());
$this->assertEquals('test.com:8080', $request->getHttpHost());
$this->assertEquals(8080, $request->getPort());
$this->assertFalse($request->isSecure());
$request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz'));
$request->server->set('REQUEST_URI', 'http://test.com/foo?bar=foo');
$this->assertEquals('http://test.com/foo?bar=baz', $request->getUri());
$this->assertEquals('/foo', $request->getPathInfo());
$this->assertEquals('bar=baz', $request->getQueryString());
$this->assertEquals('test.com', $request->getHost());
$this->assertEquals('test.com', $request->getHttpHost());
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
$request = Request::create('https://test.com:443/foo');
$request->server->set('REQUEST_URI', 'https://test.com:443/foo');
$this->assertEquals('https://test.com/foo', $request->getUri());
$this->assertEquals('/foo', $request->getPathInfo());
$this->assertEquals('test.com', $request->getHost());
$this->assertEquals('test.com', $request->getHttpHost());
$this->assertEquals(443, $request->getPort());
$this->assertTrue($request->isSecure());
// Fragment should not be included in the URI
$request = Request::create('http://test.com/foo#bar');
$request->server->set('REQUEST_URI', 'http://test.com/foo#bar');
$this->assertEquals('http://test.com/foo', $request->getUri());
}
/**
* @dataProvider getRequestUriData
*/
public function testGetRequestUri($serverRequestUri, $expected, $message)
{
$request = new Request();
$request->server->add(array(
'REQUEST_URI' => $serverRequestUri,
// For having http://test.com
'SERVER_NAME' => 'test.com',
'SERVER_PORT' => 80,
));
$this->assertSame($expected, $request->getRequestUri(), $message);
$this->assertSame($expected, $request->server->get('REQUEST_URI'), 'Normalize the request URI.');
}
public function getRequestUriData()
{
$message = 'Do not modify the path.';
yield array('/foo', '/foo', $message);
yield array('//bar/foo', '//bar/foo', $message);
yield array('///bar/foo', '///bar/foo', $message);
$message = 'Handle when the scheme, host are on REQUEST_URI.';
yield array('http://test.com/foo?bar=baz', '/foo?bar=baz', $message);
$message = 'Handle when the scheme, host and port are on REQUEST_URI.';
yield array('http://test.com:80/foo', '/foo', $message);
yield array('https://test.com:8080/foo', '/foo', $message);
yield array('https://test.com:443/foo', '/foo', $message);
$message = 'Fragment should not be included in the URI';
yield array('http://test.com/foo#bar', '/foo', $message);
yield array('/foo#bar', '/foo', $message);
}
public function testGetRequestUriWithoutRequiredHeader()
{
$expected = '';
$request = new Request();
$message = 'Fallback to empty URI when headers are missing.';
$this->assertSame($expected, $request->getRequestUri(), $message);
$this->assertSame($expected, $request->server->get('REQUEST_URI'), 'Normalize the request URI.');
}
public function testCreateCheckPrecedence()
@ -332,6 +430,9 @@ class RequestTest extends TestCase
{
$request = new Request();
$this->assertEquals('json', $request->getFormat('application/json; charset=utf-8'));
$this->assertEquals('json', $request->getFormat('application/json;charset=utf-8'));
$this->assertEquals('json', $request->getFormat('application/json ; charset=utf-8'));
$this->assertEquals('json', $request->getFormat('application/json ;charset=utf-8'));
}
/**

View file

@ -160,7 +160,7 @@ class PdoSessionHandlerTest extends TestCase
if (\defined('HHVM_VERSION')) {
$this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
}
if (ini_get('session.use_strict_mode')) {
if (filter_var(ini_get('session.use_strict_mode'), FILTER_VALIDATE_BOOLEAN)) {
$this->markTestSkipped('Strict mode needs no locking for new sessions.');
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"