php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16238 some HTTP vars seems to have no value
Submitted: 2002-03-23 14:41 UTC Modified: 2002-03-25 17:21 UTC
From: akos at docca dot hu Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.1.2 OS: Linux
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: akos at docca dot hu
New email:
PHP Version: OS:

 

 [2002-03-23 14:41 UTC] akos at docca dot hu
I don't know is this a bug or feature:

The problem: some of the http vars seems to has no value referenced by $varname or by $_REQUEST["varname"] but it has the right value at $_GET/$_POST["varname"]. 
Cause:
a cookie named "varname" not deleted correctly by setcookie("varname") just truncated to "".

I have this simple code (the point is: $partner):

<?php
echo "<br> -----------------<br>REQ:<br> ";
var_dump($_REQUEST);
echo "<br> -----------------<br>GET:<br>";
var_dump($_GET);
echo "<br> -----------------<br>POST:<br> ";
var_dump($_POST);
echo "<br> -----------------<br> "; 
?>

Result:
-----------------
REQ:
array(12) { ["partner"]=> string(0) "" ["haszon"]=> string(1) "4" ["webcalendar_login"]=> string(4) "akos"  
-----------------
GET:
array(0) { } 
-----------------
POST:
array(2) { ["partner"]=> string(3) "162" ["haszon"]=> string(1) "4" } 
-----------------



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-23 14:49 UTC] derick@php.net
What does this show in your example:
var_dump ($_COOKIE)

Derick
 [2002-03-23 15:09 UTC] akos at docca dot hu
Yes, I have a cookie says partner= 
As I wrote, the problem has been solved: I had to change
setcookie("partner") 
to 
setcookie("partner", "", time() - 3600);
but I don't know exactly why. Before the upgrade (4.0.x to 4.1.2) had no matter.
 [2002-03-23 15:10 UTC] derick@php.net
Again, what does this show in your example:
var_dump ($_COOKIE)

It's important to see this in order to check this out :)

Derick
 [2002-03-23 15:33 UTC] akos at docca dot hu
Dear Komissar Derrick,

Here we go:
Case 1: (setcookie("partner");)
COOK:
array(10) { ["webcalendar_login"]=> string(4) "akos" ["partner"]=> string(0) "" } 

REQ:
array(11) { ["partner"]=> string(0) "" ...

POST:
array(2) { ["partner"]=> string(3) "162"


Case 2: (setcookie("partner", "", time() - 3600);

$_COOKIE contains no "partner",
POST:
array(2) { ["partner"]=> string(3) "162"
REQ:
array(11) { ["partner"]=> string(3) "162"


Sorry about my slothfulness... :)
 [2002-03-25 17:21 UTC] sniper@php.net
This is not bug. $_REQUEST[] contains all the following
types of variables:

; This directive describes the order in which PHP registers GET, POST, Cookie,
; Environment and Built-in variables (G, P, C, E & S respectively, often
; referred to as EGPCS or GPC).  Registration is done from left to right, newer
; values override older values.
variables_order = "EGPCS"

So of course it works correctly if you delete the cookie.

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC