diff --git a/.travis.yml b/.travis.yml index 03ee7365..dff6b451 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ cache: env: global: - - COMPOSER_ARGS="--no-interaction" + - COMPOSER_ARGS="--no-interaction --no-plugins" - COVERAGE_DEPS="php-coveralls/php-coveralls" matrix: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ee28cee..876215d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- Nothing. +- [#7](https://github.com/mezzio/mezzio-swoole/pull/7) fixes default value for SameSite in Cookie of Swoole\Http\Response. ## 2.6.1 - 2020-03-28 diff --git a/src/SwooleEmitter.php b/src/SwooleEmitter.php index ea321977..e576232d 100644 --- a/src/SwooleEmitter.php +++ b/src/SwooleEmitter.php @@ -100,7 +100,7 @@ private function emitBody(ResponseInterface $response) : void private function emitCookies(ResponseInterface $response) : void { foreach (SetCookies::fromResponse($response)->getAll() as $cookie) { - $sameSite = $cookie->getSameSite() ? substr($cookie->getSameSite()->asString(), 9) : null; + $sameSite = $cookie->getSameSite() ? substr($cookie->getSameSite()->asString(), 9) : ''; $this->swooleResponse->cookie( $cookie->getName(), diff --git a/test/SwooleEmitterTest.php b/test/SwooleEmitterTest.php index 0b8d5180..cc604e7e 100644 --- a/test/SwooleEmitterTest.php +++ b/test/SwooleEmitterTest.php @@ -94,13 +94,13 @@ public function testMultipleSetCookieHeaders() ->header('Set-Cookie', Argument::any()) ->shouldNotBeCalled(); $this->swooleResponse - ->cookie('foo', 'bar', 0, '/', '', false, false, null) + ->cookie('foo', 'bar', 0, '/', '', false, false, '') ->shouldHaveBeenCalled(); $this->swooleResponse - ->cookie('bar', 'baz', 0, '/', '', false, false, null) + ->cookie('bar', 'baz', 0, '/', '', false, false, '') ->shouldHaveBeenCalled(); $this->swooleResponse - ->cookie('baz', 'qux', 1623233894, '/', 'somecompany.co.uk', true, true, null) + ->cookie('baz', 'qux', 1623233894, '/', 'somecompany.co.uk', true, true, '') ->shouldHaveBeenCalled(); // SameSite cookies