php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61037 Cookie Name Changing
Submitted: 2012-02-10 06:50 UTC Modified: 2012-02-10 08:00 UTC
From: anoop_alex at yahoo dot com Assigned:
Status: Not a bug Package: Apache related
PHP Version: 5.3SVN-2012-02-10 (SVN) OS: Windows 7 Prof
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: anoop_alex at yahoo dot com
New email:
PHP Version: OS:

 

 [2012-02-10 06:50 UTC] anoop_alex at yahoo dot com
Description:
------------
My application supports user IDs with underscore or dot between alphanumeric string. The users preferences are stored in cookies. The cookie key is prefixed with the user id. It is observed that the dots in the userIDs are getting converted to underscores in the setCookie method. The same replacement doesn't appear to happen during retrieve and hence the application fails to detect the preferences.

Sample Script:
<?php
        setcookie("test.cookie.error","something");
        print_r($_COOKIE);
?>

Output
Array ( [test_cookie_error] => something ) 

Test script:
---------------
<?php
        setcookie("test.cookie.error","something");
        print_r($_COOKIE);
?>



Expected result:
----------------
Array ( [test.cookie.error] => something )



Actual result:
--------------
Array ( [test_cookie_error] => something )

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-10 08:00 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2012-02-10 08:00 UTC] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Dots and spaces in variable names are converted to underscores. For example <input 
name="a.b" /> becomes $_REQUEST["a_b"].

http://php.net/manual/en/language.variables.external.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC