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
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC