Strange Problem with Virtual hosts and sessions in IE / EDGE

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Strange Problem with Virtual hosts and sessions in IE / EDGE

Postby Cricri042 » 22. June 2016 17:24

Hi,
I found a very strange problem when using xampp and virtual host on w10, version php7.
The problem comes up when using EDGE or Internet Explorer and running php in a virtual host. If the virtual host name contains underscore, the sessions are regenerated at each call.
Let me try to explain, I've created a virtual host named "php_test.cricri.fr" and if I run the following index.php :

<?php
session_start();
echo "session id: ".session_id ()."<br>";
?>
<a href="http://php_test.cricri.fr/index.php">Go</a>

the session id is different each time I reload the page (by clicking on the link).

If I do a virtual host named "phptest.cricri.fr" without underscore, and if I run the folowing index.php :

<?php
session_start();
echo "session id: ".session_id ()."<br>";
?>
<a href="http://phptest.cricri.fr/index.php">Go</a>

Everything works well and the session id doesn't change.

Last remark, this occurs only with EDGE or INTERNET EXPLORER (it's ok with firefox, chrome, opera, ..)
This also appears with the php version 7 (the las new version of xampp with php7).

Is this behavior normal or is it a bug ?

Thanks and regards, feel free to ask if you need more information to reproduce the problem.

--Christian
Cricri042
 
Posts: 2
Joined: 22. June 2016 17:09
XAMPP version: xampp-win32-7.0.6-0-VC14
Operating System: W10

Re: Strange Problem with Virtual hosts and sessions in IE /

Postby gsmith » 23. June 2016 16:30

Technically, domain names have a pretty small set of characters allowed. Upper and lowercase A-z, 0-9, dash/hyphen (-) and the dot. Domain names cannot start or end with a -.

A few years ago the ability to use different character sets was added but those are mapped to the characters I've listed above. Stealing wikipedia's example of this, københavn.eu is mapped to xn--kbenhavn-54a.eu.

So nowhere is the underscore_ an allowed character. In practice it is used but IE evidently handles it differently internally than the other browsers. It is understandable in some ways because for years IE was getting trashed for not following the standards that were in place.

So where is the bug? If I were to point a finger it would be at the point that allowed you to create the php_test subdomain. Change that underscore to a hyphen in the dns record and vhost and it should be fine on everything.

https://www.domainnameshop.com/faq?id=7
https://www.domainit.com/support/faq.mh ... question=9
https://en.wikipedia.org/wiki/Domain_name
http://stackoverflow.com/questions/7111 ... sub-domain
gsmith
 
Posts: 194
Joined: 29. November 2013 18:04
Location: San Diego
XAMPP version: 0.0.0
Operating System: Win XP to 2012R2/VS 6,9,11,14

Re: Strange Problem with Virtual hosts and sessions in IE /

Postby Cricri042 » 23. June 2016 16:55

Hi gsmith,
Many thanks for this clear answer.
What I did was just removing the underscore, and I agree with you, Microsoft people are not always aware with standards (but in this case maybe they are right as the underscore seems not too be in the standard !).
Anyway, I will just now, take as a rule to no more use this char in domains and subdomains !!.

--Christian
Cricri042
 
Posts: 2
Joined: 22. June 2016 17:09
XAMPP version: xampp-win32-7.0.6-0-VC14
Operating System: W10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 59 guests