php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6424 SetCookie with array
Submitted: 2000-08-29 19:42 UTC Modified: 2000-12-07 11:34 UTC
From: nbhanji at home dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 4.0.1pl2 OS: Linux 2.2.16 - RedHat
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nbhanji at home dot com
New email:
PHP Version: OS:

 

 [2000-08-29 19:42 UTC] nbhanji at home dot com
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-01 11:05 UTC] sniper@php.net
Does this still happen when using PHP4.0.3pl1?

--Jani
 [2000-12-07 11:34 UTC] sniper@php.net
Reopen, if this still happens when using latest snapshot
from http://snaps.php.net/

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC