Q:

Why won't my cookie value change in PHP 5?

I have a website where the login info is optionally saved in a cookie (remember me checkbox at login) and when the user logs out, the value of the authentication cookie won't change to expire the cookie allowing logout.
The system does work correctly in both the dev and staging servers but for some reason will not work on our production server.  We are running PHP 5 and Apache on all the servers.
Thanks.
Function to set cookie (minor edits for security):   
function setCookieInfo($data,$expiry=0)
{
   if($data === false)
   {
       //remove cookie!
       $cookie = false;
       $expiry = 100; //should be in the past enough!
   }
   else
   {
       $serial = base64_encode(serialize($data));
       $hash = md5($XXX);
       $cookie = $hash."---".$serial;
   }

   if($_SERVER['SERVER_NAME']=='localhost')
   {
       $domain = null;
   }
   else
   {
       $domain = '.'.$_SERVER['SERVER_NAME'];
   }

   return setcookie('Auth', $cookie, $expiry, $this->controller->base, $domain);
}

A:

Posting some actual code might help, but I'll hazard a guess that it has something to do with the cookie domain being used.

