php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24357 cookies not assigned - at all
Submitted: 2003-06-27 08:21 UTC Modified: 2003-06-27 09:48 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: calin dot brandabur at mobilesolutions dot ro Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 4.3.2 OS: windows server 2003
Private report: No CVE-ID: None
 [2003-06-27 08:21 UTC] calin dot brandabur at mobilesolutions dot ro
Description:
------------
i installed apache 2.0.46 and php 4.3.2 and the cookies are no longer working... at all

see 
http://test.mobilesolutions.ro
(win2k3 server)

and
http://new.v2r.ag/cookie
(linux server with older version of php/apache)

Reproduce code:
---------------
<?

if(!$username) {
  $username = "user";
  $password = "pass";
  $cookie_expire = "01/01/2099";
  setcookie ("username", $username, $cookie_expire);
  setcookie ("password", $password, $cookie_expire);
  echo "<b>cookie set</b><br><br>";
}
else {
  echo "<b>cookie found</b><br><br>";
}

echo "<b>cookie info</b><br>username:{$username}<br>password:{$password}";
?>


Expected result:
----------------
First run:

cookie set

cookie info
username:user
password:pass




Second run:

cookie set

cookie info
username:user
password:pass

Actual result:
--------------
Every run:

cookie set

cookie info
username:user
password:pass


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-27 08:23 UTC] calin dot brandabur at mobilesolutions dot ro
Actually the first run should return

cookie set

cookie info
username:user
password:pass


and the second run

cookie *found*

cookie info
username:user
password:pass
 [2003-06-27 09:32 UTC] derick@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.

.
 [2003-06-27 09:45 UTC] calin dot brandabur at mobilesolutions dot ro
This is odd because when i installed php i modified php.ini and changed register_globals to on...

This code is not working either:

<?

if(!isset($_COOKIE['username'])) {
  $username = "user";
  $password = "pass";
  $cookie_expire = "01/01/2099";
  setcookie ("username", $username, $cookie_expire);
  setcookie ("password", $password, $cookie_expire);
  echo "<b>cookie set</b><br><br>";
}
else {
  echo "<b>cookie found</b><br><br>";
}

echo "<b>cookie info</b><br>username:".$_COOKIE['username']."<br>password:".$_COOKIE['password'];
?>
 [2003-06-27 09:48 UTC] derick@php.net
Also very bogus:
  $cookie_expire = "01/01/2099";

Read the manual...

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 26 05:01:31 2024 UTC