In Craft 2, we could set a cookie like this...
... and that would make it a state cookie. This thread describes it pretty well. Essentially, you would end up with a cookie whose name began with a hashed string.
However, it seems like that behavior has been largely removed in Craft 3. When I try to save a cookie now, I do it more like this...
$cookie = new Cookie(); $cookie->name = $cookieName; $cookie->value = $cookieValue; $cookie->expire = time() + $lifespan; Craft::$app->getResponse()->getCookies()->add($cookie);
... which doesn't create a state cookie. The cookie name is very simple.
Generally speaking, that doesn't bother me. But I worry about compatibility issues with the Craft 2 version of my plugin. It's somewhat important that cookies from the old system are recognized when Craft is upgraded.
What is the solution for this? How do I ensure that my old cookies are recognized properly, and/or continue saving this data using the original hashed format?