Skip to content

Duplicate Set-Cookie headers on Laravel #103

Closed
@adrianfalleiro

Description

@adrianfalleiro

When using this HttpKernel adapter with the Laravel bootstrap I am seeing duplicate Set-Cookie headers being sent.

screen shot 2018-05-02 at 1 05 01 pm

Is this supposed to happen? It doesn't seem to break anything in my testing so far though.

From what I can see, this is occurring because of line 276 of PHPPM\Bridges\HttpKernel in which an array of cookies is being merged with existing Set-Cookie headers on the SymfonyResponse object:

$headers['Set-Cookie'] = array_merge((array)$headers['Set-Cookie'], $cookies);

Does this need to happen? You're already merging $nativeHeaders with all of the SymfonyResponse object headers on line 247:

$headers = array_merge($nativeHeaders, $syResponse->headers->allPreserveCase());

I've created a demo project to show the issue: https://github.com/adrianfalleiro/laravel-5.6-ppm-example

All you need to do is composer install and then ./vendor/bin/ppm start. If you inspect the headers on the home page you should be able to see duplicate Set-Cookie headers sent.

Also for context I am running this on macOS 10.12.6 with PHP 7.2.4 installed (via Homebrew).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions