laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.78k stars 296 forks source link

Swoole deprecation errors for cookies with null values #641

Closed oprypkhantc closed 1 year ago

oprypkhantc commented 1 year ago

Description:

Out of the box, when you do cookie()->forget('cookie_name') Laravel saves a cookie with null value under the hood. This cookie is then fed into Swoole's response object here: https://github.com/laravel/octane/blob/1.x/src/Swoole/SwooleClient.php#L192, which in turn triggers a deprecation error from Swoole itself: Swoole\Http\Response::cookie(): Passing null to parameter #2 ($value) of type string is deprecated in /app/vendor/laravel/octane/src/Swoole/SwooleClient.php:200.

When either not using Octane at all or using Roadrunner, Symfony's Cookie class handles missing value by converting null cookie value to "deleted".

Steps To Reproduce:

Enable deprecation warnings; then do cookie()->forget('cookie_name') in an Octane Swoole server.

driesvints commented 1 year ago

Thanks. I think the symfony solution is probably something we should follow. Can you send in a PR?