php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27267 can't set cookies with points (.) and spaces ( )
Submitted: 2004-02-15 20:11 UTC Modified: 2004-02-15 23:18 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: silkensedai at online dot fr Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.3.4 OS: Linux Mandrake 9.2 + cooker
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: silkensedai at online dot fr
New email:
PHP Version: OS:

 

 [2004-02-15 20:11 UTC] silkensedai at online dot fr
Description:
------------
When we set a cookie with the function setcookie() and when the cookie name have spaces " " or points ".", these characters are replaced by underscures '_'.
I think that can be fix by urlencodind points (%2E) and spaces (%20).

Reproduce code:
---------------
<?php
setcookie('cookie_name.with spaces', 'value', time()+10000);
?>
<pre><?php print_r($_COOKIE); ?></pre>
<a href='#'>Reload</a>


Expected result:
----------------
===========
First time:
===========
Array
(
)

Reload
============
Second time:
============
Array
(
    [cookie_name.with spaces] => value
)

Reload

Actual result:
--------------
===========
First time:
===========
Array
(
)

Reload
============
Second time:
============
Array
(
    [cookie_name_with_spaces] => value
)

Reload

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-15 23:18 UTC] sniper@php.net
Cookie names adhere to same rules as PHP variable names. Neither can contain spaces or periods.

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Aug 16 10:05:45 2022 UTC