Cookie::__construct(): Argument #1 ($name) must be of type string, int given

Hello.
An error occurs when trying to check if a cookie exists.

code:

$this->getRequest()->getCookieCollection()->has('something');

Error:

# Cake\Http\Cookie\Cookie::__construct(): Argument #1 ($name) must be of type string, int given, called in vendor/cakephp/cakephp/src/Http/Cookie/CookieCollection.php on line 90

The error seems to occur when the name of the cookie is int.

I don’t know why there is an int cookie in the cookie, but there seems to be a case where it enters somewhere.

Is there any way to successfully confirm the existence of an int cookie even if it exists?

Version: CakePHP 4.3.7

This is definitely a bug. I will create a issue on the cakephp repo.
See Cookie::__construct(): Argument #1 ($name) must be of type string, int given, · Issue #17094 · cakephp/cakephp · GitHub

1 Like

Thanks!
Waiting for the fix to be released.

This fix has been released, see Release CakePHP 4.4.13 released · cakephp/cakephp · GitHub

1 Like