PHP 4.0 Bug #6424: SetCookie with array
| From: | nbhanji at home dot com | Date: | Tue, 29 Aug 2000 23:42:33 +0000 |
| Subject: | PHP 4.0 Bug #6424: SetCookie with array | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-31173@lists.php.net to get a copy of this message | ||
From: nbhanji@home.com
Operating system: Linux 2.2.16 - RedHat
PHP version: 4.0.1pl2
PHP Bug Type: Other
Bug description: SetCookie with array
I have similar problem:
I am using php 4.0.1 pl 2, and redhat 2.2.16 with mysql 3.23.xx. My problem is that I am losing
some values when I set cookie using array. for example:
in file:
loginAction.php
setcookie ("s_cookie[0]","0",time()+3600,"/");
setcookie ("s_cookie[1]","1",time()+3600,"/");
setcookie ("s_cookie[2]","2",time()+3600,"/");
setcookie ("s_cookie[7]","7",time()+3600,"/");
in file:
nSessionAction.php
setcookie ("s_cookie[3]","3",time()+3600,"/");
setcookie ("s_cookie[4]","4",time()+3600,"/");
setcookie ("s_cookie[5]","5",time()+3600,"/");
setcookie ("s_cookie[6]","6",time()+3600,"/");
updateUserSession($s_cook);
in file:
functions.php
function updateUserSession($s_cook){
for($index=0;$index< count($s_cook);$index++){
echo $s_cook[$index] . "x";
}
}
The output I get is as follows:
run #1:
0x1x2xx4xxxx
run #2:
0x1x2x3xxxxx
run #3:
0x1x2xxxxx0x
output changes randomly, though the order of loosing is similar after shutting down the browser and
starting it again. This happens on both Netscape 4.74 and IE 5.0.
in IE5 for mac, I can see the cookies are in right order and have right values.
I have followed the example in php professional programming.