php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20271 Unable to set a cookie with _ in the host
Submitted: 2002-11-05 18:54 UTC Modified: 2002-11-06 05:39 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: scottmacvicar at ntlworld dot com Assigned:
Status: Not a bug Package: Apache related
PHP Version: 4.3.0-pre2 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: scottmacvicar at ntlworld dot com
New email:
PHP Version: OS:

 

 [2002-11-05 18:54 UTC] scottmacvicar at ntlworld dot com
If you create a host with an underscore in the domain you are unable to set cookie. I created one with the name site_v1.domain.com and any attempt to set a cookie was unsuccessful, I then used the IP address instead and it worked fine.

I then tested this on a different system with the following code.

<?php

setcookie('name', 'value', time()+3600);

echo '<pre>';
print_r($_COOKIE);
echo '</pre>';

?>

Yes i did reload the page. I've tried php 4.2.3 and 4.3.0-pre2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-06 05:39 UTC] msopacua@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Your nameserver is broken, see:
http://www.rfc-editor.org/rfc/std/std13.txt

Secion 3.5. Preferred name syntax, Page [10], shows allowed characters for hostnames. The underscore is not one of them.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC