diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-07-13 22:13:09 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-07-13 22:13:09 +0100 |
| commit | ea75abda1c0370fb1de46fb302c8871017f17632 (patch) | |
| tree | 6ad700e0af225680cbeb9349882aa77f9292f5e9 /vendor/symfony/http-foundation | |
| parent | d0bcc06fc828c5fd8500d82c2aef6b766eb1c443 (diff) | |
| download | webtrees-ea75abda1c0370fb1de46fb302c8871017f17632.tar.gz webtrees-ea75abda1c0370fb1de46fb302c8871017f17632.tar.bz2 webtrees-ea75abda1c0370fb1de46fb302c8871017f17632.zip | |
Update vendor dependencies
Diffstat (limited to 'vendor/symfony/http-foundation')
5 files changed, 46 insertions, 8 deletions
diff --git a/vendor/symfony/http-foundation/JsonResponse.php b/vendor/symfony/http-foundation/JsonResponse.php index 4dae091faa..c0a6916f05 100644 --- a/vendor/symfony/http-foundation/JsonResponse.php +++ b/vendor/symfony/http-foundation/JsonResponse.php @@ -18,7 +18,7 @@ namespace Symfony\Component\HttpFoundation; * object. It is however recommended that you do return an object as it * protects yourself against XSSI and JSON-JavaScript Hijacking. * - * @see https://www.owasp.org/index.php/OWASP_AJAX_Security_Guidelines#Always_return_JSON_with_an_Object_on_the_outside + * @see https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/AJAX_Security_Cheat_Sheet.md#always-return-json-with-an-object-on-the-outside * * @author Igor Wiedler <igor@wiedler.ch> */ @@ -55,10 +55,10 @@ class JsonResponse extends Response * * Example: * - * return JsonResponse::create($data, 200) + * return JsonResponse::create(['key' => 'value']) * ->setSharedMaxAge(300); * - * @param mixed $data The json response data + * @param mixed $data The JSON response data * @param int $status The response status code * @param array $headers An array of response headers * @@ -70,7 +70,18 @@ class JsonResponse extends Response } /** - * Make easier the creation of JsonResponse from raw json. + * Factory method for chainability. + * + * Example: + * + * return JsonResponse::fromJsonString('{"key": "value"}') + * ->setSharedMaxAge(300); + * + * @param string|null $data The JSON response string + * @param int $status The response status code + * @param array $headers An array of response headers + * + * @return static */ public static function fromJsonString($data = null, $status = 200, $headers = []) { diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php index c3ac19d4a9..d1263ca7a1 100644 --- a/vendor/symfony/http-foundation/Response.php +++ b/vendor/symfony/http-foundation/Response.php @@ -684,7 +684,7 @@ class Response return (int) $age; } - return max(time() - $this->getDate()->format('U'), 0); + return max(time() - (int) $this->getDate()->format('U'), 0); } /** @@ -764,7 +764,7 @@ class Response } if (null !== $this->getExpires()) { - return (int) ($this->getExpires()->format('U') - $this->getDate()->format('U')); + return (int) $this->getExpires()->format('U') - (int) $this->getDate()->format('U'); } return null; diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php index 867ceba97f..db0b9aeb0b 100644 --- a/vendor/symfony/http-foundation/Session/Session.php +++ b/vendor/symfony/http-foundation/Session/Session.php @@ -253,7 +253,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ public function getBag($name) { - return $this->storage->getBag($name)->getBag(); + $bag = $this->storage->getBag($name); + + return method_exists($bag, 'getBag') ? $bag->getBag() : $bag; } /** diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php index 0623318d0a..a3877ef4c7 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php @@ -681,7 +681,7 @@ class PdoSessionHandler extends AbstractSessionHandler switch ($this->driver) { case 'mysql': // MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced. - $lockId = \substr($sessionId, 0, 64); + $lockId = substr($sessionId, 0, 64); // should we handle the return value? 0 on timeout, null on error // we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout $stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)'); diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php index afa00fc7c3..acb129984e 100644 --- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\SessionBagProxy; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; /** @@ -260,4 +261,28 @@ class SessionTest extends TestCase $flash->get('hello'); $this->assertTrue($this->session->isEmpty()); } + + public function testGetBagWithBagImplementingGetBag() + { + $bag = new AttributeBag(); + $bag->setName('foo'); + + $storage = new MockArraySessionStorage(); + $storage->registerBag($bag); + + $this->assertSame($bag, (new Session($storage))->getBag('foo')); + } + + public function testGetBagWithBagNotImplementingGetBag() + { + $data = []; + + $bag = new AttributeBag(); + $bag->setName('foo'); + + $storage = new MockArraySessionStorage(); + $storage->registerBag(new SessionBagProxy($bag, $data, $usageIndex)); + + $this->assertSame($bag, (new Session($storage))->getBag('foo')); + } } |
