summaryrefslogtreecommitdiff
path: root/vendor/symfony
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony')
-rw-r--r--vendor/symfony/debug/ExceptionHandler.php90
-rw-r--r--vendor/symfony/http-foundation/HeaderBag.php8
-rw-r--r--vendor/symfony/http-foundation/Response.php14
-rw-r--r--vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php8
-rw-r--r--vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php2
-rw-r--r--vendor/symfony/http-foundation/Session/Session.php10
-rw-r--r--vendor/symfony/http-foundation/Session/SessionBagProxy.php5
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php4
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php2
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php18
-rw-r--r--vendor/symfony/http-foundation/StreamedResponse.php12
-rw-r--r--vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected2
-rw-r--r--vendor/symfony/http-foundation/Tests/ResponseTest.php7
-rw-r--r--vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php22
-rw-r--r--vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php25
-rw-r--r--vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php33
-rw-r--r--vendor/symfony/http-foundation/Tests/StreamedResponseTest.php18
-rw-r--r--vendor/symfony/http-kernel/Controller/ControllerResolver.php4
-rw-r--r--vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php2
-rw-r--r--vendor/symfony/http-kernel/Event/GetResponseEvent.php2
-rw-r--r--vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php7
-rw-r--r--vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php2
-rw-r--r--vendor/symfony/http-kernel/Kernel.php10
-rw-r--r--vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php34
-rw-r--r--vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php13
-rw-r--r--vendor/symfony/http-kernel/Tests/KernelTest.php2
26 files changed, 281 insertions, 75 deletions
diff --git a/vendor/symfony/debug/ExceptionHandler.php b/vendor/symfony/debug/ExceptionHandler.php
index f22b70f6e8..4a324d6fe5 100644
--- a/vendor/symfony/debug/ExceptionHandler.php
+++ b/vendor/symfony/debug/ExceptionHandler.php
@@ -208,48 +208,54 @@ class ExceptionHandler
$title = 'Whoops, looks like something went wrong.';
}
+ if (!$this->debug) {
+ return <<<EOF
+ <div class="container">
+ <h1>$title</h1>
+ </div>
+EOF;
+ }
+
$content = '';
- if ($this->debug) {
- try {
- $count = count($exception->getAllPrevious());
- $total = $count + 1;
- foreach ($exception->toArray() as $position => $e) {
- $ind = $count - $position + 1;
- $class = $this->formatClass($e['class']);
- $message = nl2br($this->escapeHtml($e['message']));
- $content .= sprintf(<<<'EOF'
- <div class="trace trace-as-html">
- <table class="trace-details">
- <thead class="trace-head"><tr><th>
- <h3 class="trace-class">
- <span class="text-muted">(%d/%d)</span>
- <span class="exception_title">%s</span>
- </h3>
- <p class="break-long-words trace-message">%s</p>
- </th></tr></thead>
- <tbody>
+ try {
+ $count = count($exception->getAllPrevious());
+ $total = $count + 1;
+ foreach ($exception->toArray() as $position => $e) {
+ $ind = $count - $position + 1;
+ $class = $this->formatClass($e['class']);
+ $message = nl2br($this->escapeHtml($e['message']));
+ $content .= sprintf(<<<'EOF'
+ <div class="trace trace-as-html">
+ <table class="trace-details">
+ <thead class="trace-head"><tr><th>
+ <h3 class="trace-class">
+ <span class="text-muted">(%d/%d)</span>
+ <span class="exception_title">%s</span>
+ </h3>
+ <p class="break-long-words trace-message">%s</p>
+ </th></tr></thead>
+ <tbody>
EOF
- , $ind, $total, $class, $message);
- foreach ($e['trace'] as $trace) {
- $content .= '<tr><td>';
- if ($trace['function']) {
- $content .= sprintf('at <span class="trace-class">%s</span><span class="trace-type">%s</span><span class="trace-method">%s</span>(<span class="trace-arguments">%s</span>)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
- }
- if (isset($trace['file']) && isset($trace['line'])) {
- $content .= $this->formatPath($trace['file'], $trace['line']);
- }
- $content .= "</td></tr>\n";
+ , $ind, $total, $class, $message);
+ foreach ($e['trace'] as $trace) {
+ $content .= '<tr><td>';
+ if ($trace['function']) {
+ $content .= sprintf('at <span class="trace-class">%s</span><span class="trace-type">%s</span><span class="trace-method">%s</span>(<span class="trace-arguments">%s</span>)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
}
-
- $content .= "</tbody>\n</table>\n</div>\n";
- }
- } catch (\Exception $e) {
- // something nasty happened and we cannot throw an exception anymore
- if ($this->debug) {
- $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
- } else {
- $title = 'Whoops, looks like something went wrong.';
+ if (isset($trace['file']) && isset($trace['line'])) {
+ $content .= $this->formatPath($trace['file'], $trace['line']);
+ }
+ $content .= "</td></tr>\n";
}
+
+ $content .= "</tbody>\n</table>\n</div>\n";
+ }
+ } catch (\Exception $e) {
+ // something nasty happened and we cannot throw an exception anymore
+ if ($this->debug) {
+ $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
+ } else {
+ $title = 'Whoops, looks like something went wrong.';
}
}
@@ -278,6 +284,14 @@ EOF;
*/
public function getStylesheet(FlattenException $exception)
{
+ if (!$this->debug) {
+ return <<<'EOF'
+ body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; }
+ .container { margin: 30px; max-width: 600px; }
+ h1 { color: #dc3545; font-size: 24px; }
+EOF;
+ }
+
return <<<'EOF'
body { background-color: #F9F9F9; color: #222; font: 14px/1.4 Helvetica, Arial, sans-serif; margin: 0; padding-bottom: 45px; }
diff --git a/vendor/symfony/http-foundation/HeaderBag.php b/vendor/symfony/http-foundation/HeaderBag.php
index 7aaa52ae56..d811b52758 100644
--- a/vendor/symfony/http-foundation/HeaderBag.php
+++ b/vendor/symfony/http-foundation/HeaderBag.php
@@ -101,11 +101,11 @@ class HeaderBag implements \IteratorAggregate, \Countable
/**
* Returns a header value by name.
*
- * @param string $key The header name
- * @param string|string[] $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|string[]|null $default The default value
+ * @param bool $first Whether to return the first value or all header values
*
- * @return string|string[] The first header value or default value if $first is true, an array of values otherwise
+ * @return string|string[]|null The first header value or default value if $first is true, an array of values otherwise
*/
public function get($key, $default = null, $first = true)
{
diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php
index e05194b018..7c1edd5a5e 100644
--- a/vendor/symfony/http-foundation/Response.php
+++ b/vendor/symfony/http-foundation/Response.php
@@ -64,7 +64,12 @@ class Response
const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918
const HTTP_LOCKED = 423; // RFC4918
const HTTP_FAILED_DEPENDENCY = 424; // RFC4918
+
+ /**
+ * @deprecated
+ */
const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817
+ const HTTP_TOO_EARLY = 425; // RFC-ietf-httpbis-replay-04
const HTTP_UPGRADE_REQUIRED = 426; // RFC2817
const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
@@ -169,7 +174,7 @@ class Response
422 => 'Unprocessable Entity', // RFC4918
423 => 'Locked', // RFC4918
424 => 'Failed Dependency', // RFC4918
- 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817
+ 425 => 'Too Early', // RFC-ietf-httpbis-replay-04
426 => 'Upgrade Required', // RFC2817
428 => 'Precondition Required', // RFC6585
429 => 'Too Many Requests', // RFC6585
@@ -328,12 +333,17 @@ class Response
}
// headers
- foreach ($this->headers->allPreserveCase() as $name => $values) {
+ foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
foreach ($values as $value) {
header($name.': '.$value, false, $this->statusCode);
}
}
+ // cookies
+ foreach ($this->headers->getCookies() as $cookie) {
+ header('Set-Cookie: '.$cookie->getName().strstr($cookie, '='), false, $this->statusCode);
+ }
+
// status
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
index abbf37ee7c..f9df69e907 100644
--- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
+++ b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
@@ -124,7 +124,13 @@ class NamespacedAttributeBag extends AttributeBag
foreach ($parts as $part) {
if (null !== $array && !array_key_exists($part, $array)) {
- $array[$part] = $writeContext ? array() : null;
+ if (!$writeContext) {
+ $null = null;
+
+ return $null;
+ }
+
+ $array[$part] = array();
}
$array = &$array[$part];
diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
index 80e97f17cd..f53c9dae6c 100644
--- a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
+++ b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
@@ -24,7 +24,7 @@ interface FlashBagInterface extends SessionBagInterface
* Adds a flash message for type.
*
* @param string $type
- * @param string $message
+ * @param mixed $message
*/
public function add($type, $message);
diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php
index f0379c1697..c0978d552f 100644
--- a/vendor/symfony/http-foundation/Session/Session.php
+++ b/vendor/symfony/http-foundation/Session/Session.php
@@ -54,8 +54,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/
public function start()
{
- ++$this->usageIndex;
-
return $this->storage->start();
}
@@ -160,7 +158,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/
public function isEmpty()
{
- ++$this->usageIndex;
+ if ($this->isStarted()) {
+ ++$this->usageIndex;
+ }
foreach ($this->data as &$data) {
if (!empty($data)) {
return false;
@@ -185,8 +185,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/
public function migrate($destroy = false, $lifetime = null)
{
- ++$this->usageIndex;
-
return $this->storage->regenerate($destroy, $lifetime);
}
@@ -195,8 +193,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/
public function save()
{
- ++$this->usageIndex;
-
$this->storage->save();
}
diff --git a/vendor/symfony/http-foundation/Session/SessionBagProxy.php b/vendor/symfony/http-foundation/Session/SessionBagProxy.php
index 88005ee092..3504bdfe7b 100644
--- a/vendor/symfony/http-foundation/Session/SessionBagProxy.php
+++ b/vendor/symfony/http-foundation/Session/SessionBagProxy.php
@@ -44,6 +44,9 @@ final class SessionBagProxy implements SessionBagInterface
*/
public function isEmpty()
{
+ if (!isset($this->data[$this->bag->getStorageKey()])) {
+ return true;
+ }
++$this->usageIndex;
return empty($this->data[$this->bag->getStorageKey()]);
@@ -81,8 +84,6 @@ final class SessionBagProxy implements SessionBagInterface
*/
public function clear()
{
- ++$this->usageIndex;
-
return $this->bag->clear();
}
}
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php
index 1541ec4e0a..127e47f210 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php
@@ -11,8 +11,6 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
-@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', WriteCheckSessionHandler::class), E_USER_DEPRECATED);
-
/**
* Wraps another SessionHandlerInterface to only write the session when it has been modified.
*
@@ -31,6 +29,8 @@ class WriteCheckSessionHandler implements \SessionHandlerInterface
public function __construct(\SessionHandlerInterface $wrappedSessionHandler)
{
+ @trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', self::class), E_USER_DEPRECATED);
+
$this->wrappedSessionHandler = $wrappedSessionHandler;
}
diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
index 6416a03fdf..41410bd323 100644
--- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
@@ -411,8 +411,6 @@ class NativeSessionStorage implements SessionStorageInterface
}
if ($this->saveHandler instanceof SessionHandlerProxy) {
- session_set_save_handler($this->saveHandler->getHandler(), false);
- } elseif ($this->saveHandler instanceof \SessionHandlerInterface) {
session_set_save_handler($this->saveHandler, false);
}
}
diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php
index 53c1209a1c..b11cc397a0 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php
@@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
/**
* @author Drak <drak@zikula.org>
*/
-class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface
+class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface
{
protected $handler;
@@ -82,4 +82,20 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf
{
return (bool) $this->handler->gc($maxlifetime);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function validateId($sessionId)
+ {
+ return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function updateTimestamp($sessionId, $data)
+ {
+ return $this->handler instanceof \SessionUpdateTimestampHandlerInterface ? $this->handler->updateTimestamp($sessionId, $data) : $this->write($sessionId, $data);
+ }
}
diff --git a/vendor/symfony/http-foundation/StreamedResponse.php b/vendor/symfony/http-foundation/StreamedResponse.php
index 92868d33e4..1fb2b46af8 100644
--- a/vendor/symfony/http-foundation/StreamedResponse.php
+++ b/vendor/symfony/http-foundation/StreamedResponse.php
@@ -141,4 +141,16 @@ class StreamedResponse extends Response
{
return false;
}
+
+ /**
+ * {@inheritdoc}
+ *
+ * @return $this
+ */
+ public function setNotModified()
+ {
+ $this->setCallback(function () {});
+
+ return parent::setNotModified();
+ }
}
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected
index 4e9c4c075f..14e44a398a 100644
--- a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected
@@ -4,7 +4,7 @@ Array
[0] => Content-Type: text/plain; charset=utf-8
[1] => Cache-Control: no-cache, private
[2] => Date: Sat, 12 Nov 1955 20:04:00 GMT
- [3] => Set-Cookie: %3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/
+ [3] => Set-Cookie: ?*():@&+$/%#[]=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/
[4] => Set-Cookie: ?*():@&+$/%#[]=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/
)
shutdown
diff --git a/vendor/symfony/http-foundation/Tests/ResponseTest.php b/vendor/symfony/http-foundation/Tests/ResponseTest.php
index 350d972a94..03a9811ec3 100644
--- a/vendor/symfony/http-foundation/Tests/ResponseTest.php
+++ b/vendor/symfony/http-foundation/Tests/ResponseTest.php
@@ -126,7 +126,7 @@ class ResponseTest extends ResponseTestCase
public function testSetNotModified()
{
- $response = new Response();
+ $response = new Response('foo');
$modified = $response->setNotModified();
$this->assertObjectHasAttribute('headers', $modified);
$this->assertObjectHasAttribute('content', $modified);
@@ -135,6 +135,11 @@ class ResponseTest extends ResponseTestCase
$this->assertObjectHasAttribute('statusText', $modified);
$this->assertObjectHasAttribute('charset', $modified);
$this->assertEquals(304, $modified->getStatusCode());
+
+ ob_start();
+ $modified->sendContent();
+ $string = ob_get_clean();
+ $this->assertEmpty($string);
}
public function testIsSuccessful()
diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
index f074ce1b26..ec4cd5ad1a 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
@@ -85,6 +85,17 @@ class NamespacedAttributeBagTest extends TestCase
/**
* @dataProvider attributesProvider
*/
+ public function testHasNoSideEffect($key, $value, $expected)
+ {
+ $expected = json_encode($this->bag->all());
+ $this->bag->has($key);
+
+ $this->assertEquals($expected, json_encode($this->bag->all()));
+ }
+
+ /**
+ * @dataProvider attributesProvider
+ */
public function testGet($key, $value, $expected)
{
$this->assertEquals($value, $this->bag->get($key));
@@ -99,6 +110,17 @@ class NamespacedAttributeBagTest extends TestCase
/**
* @dataProvider attributesProvider
*/
+ public function testGetNoSideEffect($key, $value, $expected)
+ {
+ $expected = json_encode($this->bag->all());
+ $this->bag->get($key);
+
+ $this->assertEquals($expected, json_encode($this->bag->all()));
+ }
+
+ /**
+ * @dataProvider attributesProvider
+ */
public function testSet($key, $value, $expected)
{
$this->bag->set($key, $value);
diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
index c4e75b1b18..905a1f7517 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
@@ -74,6 +74,18 @@ class FlashBagTest extends TestCase
$this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
}
+ public function testAdd()
+ {
+ $tab = array('bar' => 'baz');
+ $this->bag->add('string_message', 'lorem');
+ $this->bag->add('object_message', new \stdClass());
+ $this->bag->add('array_message', $tab);
+
+ $this->assertEquals(array('lorem'), $this->bag->get('string_message'));
+ $this->assertEquals(array(new \stdClass()), $this->bag->get('object_message'));
+ $this->assertEquals(array($tab), $this->bag->get('array_message'));
+ }
+
public function testGet()
{
$this->assertEquals(array(), $this->bag->get('non_existing'));
@@ -112,6 +124,19 @@ class FlashBagTest extends TestCase
$this->assertEquals(array('notice'), $this->bag->keys());
}
+ public function testSetAll()
+ {
+ $this->bag->add('one_flash', 'Foo');
+ $this->bag->add('another_flash', 'Bar');
+ $this->assertTrue($this->bag->has('one_flash'));
+ $this->assertTrue($this->bag->has('another_flash'));
+ $this->bag->setAll(array('unique_flash' => 'FooBar'));
+ $this->assertFalse($this->bag->has('one_flash'));
+ $this->assertFalse($this->bag->has('another_flash'));
+ $this->assertSame(array('unique_flash' => 'FooBar'), $this->bag->all());
+ $this->assertSame(array(), $this->bag->all());
+ }
+
public function testPeekAll()
{
$this->bag->set('notice', 'Foo');
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
index 682825356a..0b48250e01 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
@@ -121,4 +121,37 @@ class SessionHandlerProxyTest extends TestCase
$this->proxy->gc(86400);
}
+
+ /**
+ * @requires PHPUnit 5.1
+ */
+ public function testValidateId()
+ {
+ $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock();
+ $mock->expects($this->once())
+ ->method('validateId');
+
+ $proxy = new SessionHandlerProxy($mock);
+ $proxy->validateId('id');
+
+ $this->assertTrue($this->proxy->validateId('id'));
+ }
+
+ /**
+ * @requires PHPUnit 5.1
+ */
+ public function testUpdateTimestamp()
+ {
+ $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock();
+ $mock->expects($this->once())
+ ->method('updateTimestamp');
+
+ $proxy = new SessionHandlerProxy($mock);
+ $proxy->updateTimestamp('id', 'data');
+
+ $this->mock->expects($this->once())
+ ->method('write');
+
+ $this->proxy->updateTimestamp('id', 'data');
+ }
}
diff --git a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php
index c2ded996fa..699222e379 100644
--- a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php
+++ b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php
@@ -123,4 +123,22 @@ class StreamedResponseTest extends TestCase
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders());
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders());
}
+
+ public function testSetNotModified()
+ {
+ $response = new StreamedResponse(function () { echo 'foo'; });
+ $modified = $response->setNotModified();
+ $this->assertObjectHasAttribute('headers', $modified);
+ $this->assertObjectHasAttribute('content', $modified);
+ $this->assertObjectHasAttribute('version', $modified);
+ $this->assertObjectHasAttribute('statusCode', $modified);
+ $this->assertObjectHasAttribute('statusText', $modified);
+ $this->assertObjectHasAttribute('charset', $modified);
+ $this->assertEquals(304, $modified->getStatusCode());
+
+ ob_start();
+ $modified->sendContent();
+ $string = ob_get_clean();
+ $this->assertEmpty($string);
+ }
}
diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolver.php b/vendor/symfony/http-kernel/Controller/ControllerResolver.php
index b9d9f9fa25..0811fdf772 100644
--- a/vendor/symfony/http-kernel/Controller/ControllerResolver.php
+++ b/vendor/symfony/http-kernel/Controller/ControllerResolver.php
@@ -101,7 +101,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve
*/
public function getArguments(Request $request, $controller)
{
- @trigger_error(sprintf('%s is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED);
+ @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED);
if (is_array($controller)) {
$r = new \ReflectionMethod($controller[0], $controller[1]);
@@ -126,7 +126,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve
*/
protected function doGetArguments(Request $request, $controller, array $parameters)
{
- @trigger_error(sprintf('%s is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED);
+ @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED);
$attributes = $request->attributes->all();
$arguments = array();
diff --git a/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php b/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php
index 7501077140..bfb770a0d0 100644
--- a/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php
+++ b/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php
@@ -60,7 +60,7 @@ class TraceableControllerResolver implements ControllerResolverInterface, Argume
*/
public function getArguments(Request $request, $controller)
{
- @trigger_error(sprintf('The %s method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), E_USER_DEPRECATED);
+ @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), E_USER_DEPRECATED);
$ret = $this->argumentResolver->getArguments($request, $controller);
diff --git a/vendor/symfony/http-kernel/Event/GetResponseEvent.php b/vendor/symfony/http-kernel/Event/GetResponseEvent.php
index f7745ea3dc..c25a0f1cf1 100644
--- a/vendor/symfony/http-kernel/Event/GetResponseEvent.php
+++ b/vendor/symfony/http-kernel/Event/GetResponseEvent.php
@@ -29,7 +29,7 @@ class GetResponseEvent extends KernelEvent
/**
* Returns the response object.
*
- * @return Response
+ * @return Response|null
*/
public function getResponse()
{
diff --git a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php
index 82061fd6ea..75f810e988 100644
--- a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php
+++ b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php
@@ -71,6 +71,13 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface
if ($session instanceof Session ? !$session->isEmpty() || (null !== $this->sessionId && $session->getId() !== $this->sessionId) : $wasStarted) {
$params = session_get_cookie_params();
+
+ foreach ($event->getResponse()->headers->getCookies() as $cookie) {
+ if ($session->getName() === $cookie->getName() && $params['path'] === $cookie->getPath() && $params['domain'] == $cookie->getDomain()) {
+ return;
+ }
+ }
+
$event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']));
$this->sessionId = $session->getId();
}
diff --git a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php
index 7e957d4c95..ab7a83fa57 100644
--- a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php
+++ b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php
@@ -131,7 +131,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
if ($this->templating instanceof EngineInterface) {
try {
return $this->templating->exists($template);
- } catch (\InvalidArgumentException $e) {
+ } catch (\Exception $e) {
return false;
}
}
diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php
index 3c740e45ef..be20edd8ad 100644
--- a/vendor/symfony/http-kernel/Kernel.php
+++ b/vendor/symfony/http-kernel/Kernel.php
@@ -67,11 +67,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
private $requestStackSize = 0;
private $resetServices = false;
- const VERSION = '3.4.12';
- const VERSION_ID = 30412;
+ const VERSION = '3.4.13';
+ const VERSION_ID = 30413;
const MAJOR_VERSION = 3;
const MINOR_VERSION = 4;
- const RELEASE_VERSION = 12;
+ const RELEASE_VERSION = 13;
const EXTRA_VERSION = '';
const END_OF_MAINTENANCE = '11/2020';
@@ -232,7 +232,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
}
if (!$first && !$noDeprecation) {
- @trigger_error(sprintf('Passing "false" as the second argument to %s() is deprecated as of 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
+ @trigger_error(sprintf('Passing "false" as the second argument to "%s()" is deprecated as of 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
}
if (!isset($this->bundleMap[$name])) {
@@ -734,7 +734,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
protected function getEnvParameters()
{
if (0 === func_num_args() || func_get_arg(0)) {
- @trigger_error(sprintf('The %s() method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), E_USER_DEPRECATED);
+ @trigger_error(sprintf('The "%s()" method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), E_USER_DEPRECATED);
}
$parameters = array();
diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php
index 22a2b71239..01f0a3b864 100644
--- a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php
+++ b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php
@@ -106,6 +106,36 @@ class TestSessionListenerTest extends TestCase
$this->assertNotEmpty($response->headers->getCookies());
}
+ /**
+ * @dataProvider anotherCookieProvider
+ */
+ public function testSessionWithNewSessionIdAndNewCookieDoesNotSendAnotherCookie($existing, array $expected)
+ {
+ $this->sessionHasBeenStarted();
+ $this->sessionIsEmpty();
+ $this->fixSessionId('456');
+
+ $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123'));
+ $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
+ $this->listener->onKernelRequest($event);
+
+ $response = new Response('', 200, array('Set-Cookie' => $existing));
+
+ $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST, $response);
+
+ $this->assertSame($expected, $response->headers->get('Set-Cookie', null, false));
+ }
+
+ public function anotherCookieProvider()
+ {
+ return array(
+ 'same' => array('MOCKSESSID=789; path=/', array('MOCKSESSID=789; path=/')),
+ 'different domain' => array('MOCKSESSID=789; path=/; domain=example.com', array('MOCKSESSID=789; path=/; domain=example.com', 'MOCKSESSID=456; path=/')),
+ 'different path' => array('MOCKSESSID=789; path=/foo', array('MOCKSESSID=789; path=/foo', 'MOCKSESSID=456; path=/')),
+ );
+ }
+
public function testUnstartedSessionIsNotSave()
{
$this->sessionHasNotBeenStarted();
@@ -123,10 +153,10 @@ class TestSessionListenerTest extends TestCase
$this->assertFalse(is_subclass_of(TestSessionListener::class, ServiceSubscriberInterface::class, 'Implementing ServiceSubscriberInterface would create a dep on the DI component, which eg Silex cannot afford'));
}
- private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST)
+ private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, Response $response = null)
{
$request->setSession($this->session);
- $response = new Response();
+ $response = $response ?: new Response();
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
$event = new FilterResponseEvent($kernel, $request, $type, $response);
diff --git a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php
index 1be052e5e6..7171c71bc3 100644
--- a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php
+++ b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php
@@ -86,4 +86,17 @@ class HIncludeFragmentRendererTest extends TestCase
$strategy = new HIncludeFragmentRenderer($engine);
$this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent());
}
+
+ public function testRenderWithEngineAndDefaultText()
+ {
+ $engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock();
+ $engine->expects($this->once())
+ ->method('exists')
+ ->with('loading...')
+ ->will($this->throwException(new \RuntimeException()));
+
+ // only default
+ $strategy = new HIncludeFragmentRenderer($engine);
+ $this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'loading...'))->getContent());
+ }
}
diff --git a/vendor/symfony/http-kernel/Tests/KernelTest.php b/vendor/symfony/http-kernel/Tests/KernelTest.php
index 7cde2ac5e2..916cf8d24d 100644
--- a/vendor/symfony/http-kernel/Tests/KernelTest.php
+++ b/vendor/symfony/http-kernel/Tests/KernelTest.php
@@ -809,7 +809,7 @@ EOF;
/**
* @group legacy
- * @expectedDeprecation The Symfony\Component\HttpKernel\Kernel::getEnvParameters() method is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax to get the value of any environment variable from configuration files instead.
+ * @expectedDeprecation The "Symfony\Component\HttpKernel\Kernel::getEnvParameters()" method is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax to get the value of any environment variable from configuration files instead.
* @expectedDeprecation The support of special environment variables that start with SYMFONY__ (such as "SYMFONY__FOO__BAR") is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax instead to get the value of environment variables in configuration files.
*/
public function testSymfonyEnvironmentVariables()