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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
37 + 47 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 22:01:27 2024 UTC