php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31022 Using '_' in a hostname causes sessions to break
Submitted: 2004-12-08 15:02 UTC Modified: 2004-12-08 15:12 UTC
From: spam at taylorw dot com Assigned:
Status: Not a bug Package: *Configuration Issues
PHP Version: 4.3.9 OS: Gentoo Linux
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:
30 + 25 = ?
Subscribe to this entry?

 
 [2004-12-08 15:02 UTC] spam at taylorw dot com
Description:
------------
Previously I submitted a bug report about sessions not working, in the sense that every session_start() call created a new session, and a new file in /tmp. I have concluded that the host name "spare_ribs" was the issue. By changing the hostname to "spareribs" (no '_') the session issue is fixed. I am not sure if using '_' in a hostname is against some RFC and thus this is not really a bug, but I think that since bind accepted it, and the two browsers I tried with it worked fine, this is not breaking protocol and should work fine.

(Apache 2.0.52 being used here.)

Reproduce code:
---------------
Set hostname to anything with _ such as "spare_ribs". Then reboot box and browse to page one which includes the following code.

/* Page 1 */

<?php
 session_start();
 $_SESSION['test'] = 'this is a test.';

 echo $_SESSION['test'];
 echo '<a href="page2.php">click here for page 2</a>';

?>

/* Page 2 */

<?php
 session_start();
 echo 'You should see this is a test:';
 echo $_SESSION['test'];
 echo '<a href="page1.php">click here for page 1</a>';

?>



Expected result:
----------------
Page one should say 'this is a test', and page two should say 'You should see this is a test: this is a test'. 

Actual result:
--------------
However page two only says 'You should see this is a test'. And a new session id has been assigned, as well as a new session created in /tmp.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-08 15:09 UTC] derick@php.net
_ is not allowed in domain names, so no bug here.
 [2004-12-08 15:12 UTC] derick@php.net
http://www.ietf.org/rfc/rfc1034.txt, section 3.5.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 13:01:30 2024 UTC