php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19662 cookies not set with CGI server API
Submitted: 2002-09-29 13:34 UTC Modified: 2002-10-19 01:00 UTC
Votes:9
Avg. Score:4.1 ± 0.9
Reproduced:6 of 6 (100.0%)
Same Version:4 (66.7%)
Same OS:3 (50.0%)
From: info at splendense dot nl Assigned:
Status: No Feedback Package: Other web server
PHP Version: 4.2.3 OS: SunOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
41 + 25 = ?
Subscribe to this entry?

 
 [2002-09-29 13:34 UTC] info at splendense dot nl
When I set a cookie with the setcookie command AFTER I requested the value of an nonexisting cookie (so NULL) with a different name it does not set the cookie.

I tested it on multiple systems with PHP 4.2.1 installed. On 2 systems it did not go well and 1 system it has no problem and works fine. The only difference that I can see is that the "good" system has Apache as "Server API" and the other 2 "bad" system have CGI as server API.

I ran the following script for the first time with no active cookies set:

<?php
$existing_cookie = $_COOKIE["existing_cookie"];
$value = "test";
if (setcookie ("existing_cookie", $value)) {
	print ("cookie set");
} else {
	print ("cookie NOT set");
}
print (" , existing cookie value: $existing_cookie");
?>

outputs: "cookie NOT set , existing cookie value: "

When I delete the 1st line ($existing_cookie = $_COOKIE["existing_cookie"];)

and run the script again I get as output: "cookie set , existing cookie value: "

Then I add the 1st line again ($existing_cookie = $_COOKIE["existing_cookie"];)

and run the script again and get as output:

"cookie set , existing cookie value: test"

and everything works perfectly even whenever I change the $value.

When I add the next line to the script (at line 2) it does not correctly set the cookie again.
$existing_cookie2 = $_COOKIE["existing_cookie2"];

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-01 20:44 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-03 10:35 UTC] info at splendense dot nl
I installed version 4.2.3 but it did not help.

I did not read anything about a bugfix related to cookies in the changelog either.
 [2002-10-03 19:32 UTC] sniper@php.net
You obviously didn't read my comment either..
Please try this snapshot and EXACTLY THIS:

http://snaps.php.net/php4-latest.tar.gz

 [2002-10-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-11-04 07:55 UTC] info at splendense dot nl
My ISP finally installed the new version: 4.3.0pre2 and it is still not fixed!

the OS is solaris and it took them this long since the had to install gnu sed (atleast another sed version) since 'normal' sed couldn't take the requested length of sed parameters during installation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC