#309 reintroduced (PHP session's cookie domain + port)
A bug in 2.1.2, submitted by dushakov on 23 January 2011
Announcement
Symphony's issue tracker has been moved to Github.
Issues are displayed here for reference only and cannot be created or edited.
Browse
Closed#513: #309 reintroduced (PHP session's cookie domain + port)
I believe this issue has already been resolved in the Symphony 2.2 betas.
The getDomain
function only works with PHP’s HTTP_HOST
which does not include any port information.
As a sidenote, judging by the .git
history, this issue should not be in Symphony 2.1.x branch as it was resolved July 2010.
Can you confirm you are using Symphony 2.1.2 and can recreate this issue?
Yep, per my manifest/config.php: ‘useragent’ => ‘Symphony/2.1.2’ Actually, HTTP_HOST is taken from the “Host” HTTP request header, which is filled with port usually if port directly specified in url.
I’ve just double checked: accessing host:port cause filling HTTPHOST with the same “host:port” value, while SERVERNAME gives only hostname.
So, it’s seems like SERVER_NAME is more preferable here.
Interesting, what version of Apache are you running? What port did you use?
I can’t reproduce this locally, I’ve just tried http://symphony.local:80/
and the HTTP_HOST
and SERVER_NAME
are both the same, with the SERVER_PORT
being 80.
I need to double check apache version, but it should be 2.2.15. It’s configured for virtual host with port 801.
Yep, apache 2.2.15.
Thanks, I’ll have a bit more of a poke around with this and see what I can come up with :)
Well this sent me down a bit of a rabbit hole!
In this end, Session’s is about maintaining a Cookie for the user andSERVER_NAME
is read from the Apache virtual host config, so it may differ from what the URL the user is on, which would result in the cookie not sticking.
I’ve implemented a fix similar to what you have suggested, by stripping the port from the HTTP_HOST
, which will hopefully solve your issues in this commit
This issue is closed.
Issue #309 reintroduced in 2.1.2, so i’ve just copy-pasted description from it.
However, workaround is a different now. Port could be removed with replacing line 45 (i’m not sure about other invocations of getDomain()) in symphony/lib/core/class.session.php with following:
Here is the original issue description: