ID: 22013 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: HTTP related Operating System: Windows PHP Version: 4.3.0 New Comment:
It can't really be PHP bug.. Previous Comments: ------------------------------------------------------------------------ [2003-02-02 15:18:12] [EMAIL PROTECTED] According to the spec: http://wp.netscape.com/newsref/std/cookie_spec.html The domain must have at least two periods. I'm not sure how this applies to localhost but I guess for localhost just don't set it or set as an empty string. ------------------------------------------------------------------------ [2003-02-02 13:48:21] [EMAIL PROTECTED] $domain is 'localhost' because I am testing on my local machine. I updated the script to not pass the $domain and $expirationTime to the setCookie function and the script now works. I am not sure why 'localhost' would be a problem since I see when I take out $domain and $expirationTime, Mozilla sets the host for the cookie to 'localhost'. Maybe this is a Mozilla bug. ------------------------------------------------------------------------ [2003-02-02 13:38:17] [EMAIL PROTECTED] Please confirm that HTTP_HOST exists (i.e. what $domain is) ------------------------------------------------------------------------ [2003-02-02 13:16:18] [EMAIL PROTECTED] By the way, my original test script was kind of stupid. Here is the corrected test script. <?php error_reporting(E_ALL); define('ID', 'id'); define('USERNAME', 'username'); // save the login information into the cookie which will expire in 30 // days $expirationTime = time()+60*60*24*30; $domain = $_SERVER['HTTP_HOST']; $success = true; if (!setCookie(ID, '1', $expirationTime, '/', $domain, 0)) { $success = false; } if (!setCookie(USERNAME, 'frankkim', $expirationTime, '/', $domain, 0)) { $success = false; } if ($success) { print "setCookie's succeeded"; } else { print "setCookie's failed"; } ?> ------------------------------------------------------------------------ [2003-02-02 13:15:13] [EMAIL PROTECTED] I added: error_reporting(E_ALL); to the script and saw no errors reported. This was not surprising since I have this set in php.ini: error_reporting = E_ALL; display all errors, warnings and notices display_errors = On ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22013 -- Edit this bug report at http://bugs.php.net/?id=22013&edit=1