nystudio107 / craft-cookies

A simple plugin for setting and getting cookies from within Craft CMS templates.
https://nystudio107.com/
MIT License
37 stars 6 forks source link

$sameSite must be of type boolean #37

Closed almeric closed 2 years ago

almeric commented 2 years ago

Hi,

I've ran into an issue using the v4 version of this plugin (for craft 4).

Here: https://github.com/nystudio107/craft-cookies/blob/bc5aea1f64bee21c7aa789acff2d74591236e672/src/twigextensions/CookiesTwigExtension.php#L65-L74

The $sameSite param is required to be a boolean.

But here: https://github.com/nystudio107/craft-cookies/blob/bc5aea1f64bee21c7aa789acff2d74591236e672/src/twigextensions/CookiesTwigExtension.php#L55

and here: https://github.com/nystudio107/craft-cookies/blob/bc5aea1f64bee21c7aa789acff2d74591236e672/src/twigextensions/CookiesTwigExtension.php#L42

$sameSite has a default value of null which gives the following error when setting a cookie without explicitly passing the $sameSite param:

CookiesTwigExtension::setCookie(): Argument #8 ($sameSite) must be of type bool, null given
khalwat commented 2 years ago

Addressed in 4.0.0 -> https://github.com/nystudio107/craft-cookies/releases/tag/4.0.0