Search code examples
phpcookiesframeworkskohana

Kohana framework 3.3 cookie sets twice


I'm using Kohana 3.3 and I'm trying to set a single unique cookie for every new site visitor. I'm doing it like this:

if (!Cookie::get('unique_id'))
{
    Cookie::set('unique_id', uniqid(), 9990000);
}

But when I visit my site with 'www.' in front of the domain it creates a second cookie with the same name, but different value. How can I fix this?


Solution

  • Found a solution. I had to edit the system/classes/Kohana/cookie.php file, and set a value on the $domain variable.