Doc #61893 [Wfx]: The $_REQUEST Predefined Variable Does NOT Contains the Contents of $_COOKIE

From: Date: Thu, 03 May 2012 02:24:00 +0000
Subject: Doc #61893 [Wfx]: The $_REQUEST Predefined Variable Does NOT Contains the Contents of $_COOKIE
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8334@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61893&edit=1

 ID:                 61893
 User updated by:    marcoscanrib at ig dot com dot br
 Reported by:        marcoscanrib at ig dot com dot br
 Summary:            The $_REQUEST Predefined Variable Does NOT Contains
                     the Contents of $_COOKIE
 Status:             Wont fix
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   Windows XP Prof
 PHP Version:        5.3Git-2012-05-02 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

I have just searched the documentation for the 'request_order' directive and it 
clearly states : "Note that the >>default<< distribution php.ini files does not 
contain the 'C' for cookies". 

So, I believe this proves that, >>by default<<, $_REQUEST does NOT include the 
contents of $_COOKIE and that the following statement in the documentation is 
wrong and should be fixed : "Description : An associative array that by default 
contains the contents of $_GET, $_POST and $_COOKIE."


Previous Comments:
------------------------------------------------------------------------
[2012-05-03 02:08:36] marcoscanrib at ig dot com dot br

Congratulations for the quick follow up of the users feedbacks. 

About your follow up content, I add that I have not used variables_order nor 
request_order to change the default behavior of the $_REQUEST array and I got the 
results I stated. So, at least in my PHP installation (XAMPP), the default 
behavior of the $_REQUEST is NOT to include the contents of $_COOKIE. Is there a 
way to check if XAMPP changed the default behaviour of the $_REQUEST array ?

------------------------------------------------------------------------
[2012-05-02 01:22:05] aharvey@php.net

The documentation already states clearly that that's the default behaviour only 
and can be changed via variables_order and request_order.

------------------------------------------------------------------------
[2012-05-02 01:11:32] marcoscanrib at ig dot com dot br

Description:
------------
---
From manual page: http://www.php.net/reserved.variables.request#refsect1-
reserved.variables.request-description
---


Test script:
---------------
<?php
// set the cookies
setcookie("CookieName1", 1);
setcookie("CookieName2", "two");
setcookie("CookieName3", "Cookie 3");
?>

// prints the elements of the $_COOKIE array
<pre>
<?php print_r($_COOKIE); ?>
</pre>

// prints the elements of the $_REQUEST array
<pre>
<?php print_r($_REQUEST); ?>
</pre>

Expected result:
----------------
IF the $_REQUEST predefined array contained the contents of the $_COOKIE 
predefined array, as stated at 
http://docs.php.net/manual/en/reserved.variables.request.php,
the above script 
should display : 

Array
(
    [CookieName1] => 1
    [CookieName2] => two
    [CookieName3] => Cookie 3
)
Array
(
    [CookieName1] => 1
    [CookieName2] => two
    [CookieName3] => Cookie 3
)


Actual result:
--------------
The above script displays, that clearly demonstrate that $_REQUEST does NOT 
contain the contents of $_COOKIE. I consider the real content of the $_REQUEST 
array fine, better than if it also included the contents of the $_COOKIE array. 
For me, only the documentation is wrong and should be corrected, what is very 
easy indeed.

Array
(
    [CookieName1] => 1
    [CookieName2] => two
    [CookieName3] => Cookie 3
)
Array
(
)




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61893&edit=1


Thread (7 messages)

« previous php.doc.bugs (#8334) next »