From:             richkerr at disabilitysoft dot com
Operating system: Win98
PHP version:      4.3.10
PHP Bug Type:     Output Control
Bug description:  setcookie not working in Gecko browsers

Description:
------------
Followed basic instruction in php documentation for setting cookies.  Gave
in to standards compliant browsers only, but with code below, cookies work
in  IE6.0 and Opera but not in Netscape 7.1 or Firefox 1.0.

Adding the path, domain, and secure using code identical to Manual causes
it to fail in IE as well.  Would be nice if this basic function would work
for all standards complaint browsers?

Page uses ob_start(), session_start() and no header output before call to
SetMyCookie.

Server is Apache 1.3.33 (Unix).


Reproduce code:
---------------
Function SetMyCookie($db, $login, $pwd){
        
        
if ($db == ""  and $login == "" and $pwd == ""){
setcookie("login", "", time() - 3600);//fails in netscape
setcookie("password", "", time() - 3600);
setcookie("db", "", time() - 3600);
}else{
setcookie ("login", $login, time() + 60*60*24*1800);
setcookie ("password", $pwd, time() + 60*60*24*1800);
setcookie ("db", $db, time() + 60*60*24*1800);
}



}


Expected result:
----------------
Three cookies are set with name login, password, db and values $db,
$login, and $pwd set to expire in 1800 days.  Cookies visible in the
current domain folder.

If SetMyCookie is called with empty params, then cookies, with name login,
password, and db are deleted from current domain folder.

Actual result:
--------------
Cookies not set or deleted in Gecko based browsers.

-- 
Edit bug report at http://bugs.php.net/?id=31652&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31652&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31652&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31652&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31652&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31652&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31652&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31652&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31652&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31652&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31652&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31652&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31652&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31652&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31652&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31652&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31652&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31652&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31652&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31652&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31652&r=mysqlcfg

Reply via email to