|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-02 12:35 UTC] frankkim at attbi dot com
Today I upgraded from PHP 4.2.2 to PHP 4.3. I am using Apache 2.0.43 on Windows with PHP CGI.
After doing this upgrade, setcookie() stopped working for me using Mozilla 1.3a though it continued to work using IE. setcookie() was working for me with both browsers before the upgrade.
Here is a script that illustrates the bug.
<?php
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, $this->id, $expirationTime, '/', $domain, 0)) {
$success = false;
}
if (!setCookie(USERNAME, $this->username, $expirationTime, '/', $domain, 0)) {
$success = false;
}
if ($success) {
print "setCookie's succeeded";
} else {
print "setCookie's failed";
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 13:00:01 2025 UTC |
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"; } ?>