php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1308 Cookie Value set in JavaScript not available in PHP
Submitted: 1999-04-09 09:29 UTC Modified: 1999-05-11 08:01 UTC
From: gfuelber at rrsoft dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.7 OS: Linux 2.0.36
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gfuelber at rrsoft dot com
New email:
PHP Version: OS:

 

 [1999-04-09 09:29 UTC] gfuelber at rrsoft dot com
Hi!

I?m not sure, but i think this could probably be a bug:

I set a value of a cookie in JavaScript:

<SCRIPT language="JavaScript"> 
  COOKIELIVEDAYS=1;
  var COOKIE_DELDATE="Thu, 01-Jan-1970 00:00:00 GMT";
  var COOKIE_INHALT = document.cookie.split(";");

  function cookie_live() {
    var date=new Date();
    date.setDate(date.getDate()+COOKIELIVEDAYS);
    var gmt=date.toGMTString();
    var k1=gmt.indexOf(" ");
    var k2=gmt.indexOf(" ", k1+1);
    var k3=gmt.indexOf(" ", k2+1);
    var str=gmt.substring(0,k2)+"-"+gmt.substring(k2+1,k3)+"-"+gmt.substring(k3+
3,gmt.length);
    return str;
  }

  function set_cookie(name, value) {
    document.cookie=name+"="+escape(value)+"; expires="+cookie_live();
  }     
</SCRIPT>

<?
 .....
               echo "<SCRIPT language=\"JavaScript\">
                           cookie = \"1\"; \n
                           set_cookie(\"DOUBEv\",cookie); \n
                        </SCRIPT>"; 
?>

I checked the name and value of this cookie with another JavaScript-Function: The Cookie was available and its value was 1.

When I checked the value in PHP3 with 
<?
              while (list($tmpvar, $tmpvalue)=each($HTTP_COOKIE_VARS)) {
                     echo "$tmpvar : $tmpvalue <BR>\n";  }
?>
2 other cookies set before in PHP were available, but not the cookie set just before by the JavaScript-Function.
Also the value of  $DOUBEv  in PHP3 was not available, an I think here could be a bug

Gerhard.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-05-11 08:01 UTC] sas at cvs dot php dot net
This must be a programming error on your side. There is absolutely no difference between _correctly_ set cookies, whether they are send by the server or set by the client.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 05 04:01:35 2025 UTC