Symfony: Breaking change using array values in cookies since Symfony v3.3

Created on 1 Jun 2017  路  1Comment  路  Source: symfony/symfony

| Q | A
| ---------------- | -----
| Bug report? | yes
| Feature request? | no
| BC Break report? | yes
| RFC? | yes
| Symfony version | 3.3.*

Please see this issue for details and code snippets.

Bug HttpFoundation Needs Review

Most helpful comment

Passing array values as the cookie value was never supported in Symfony. The contract in Symfony 3.2 and older is string only: https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/HttpFoundation/Cookie.php#L38

For 3.3, we actually changed it to allow string|null.

Btw, I don't see how this could work in 3.2 either. AFAICT, it should also be triggering a Array to string conversion notice, as it also casts the value to string in 3.2

>All comments

Passing array values as the cookie value was never supported in Symfony. The contract in Symfony 3.2 and older is string only: https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/HttpFoundation/Cookie.php#L38

For 3.3, we actually changed it to allow string|null.

Btw, I don't see how this could work in 3.2 either. AFAICT, it should also be triggering a Array to string conversion notice, as it also casts the value to string in 3.2

Was this page helpful?
0 / 5 - 0 ratings