5 users online. Create an account or sign in to join them.Users

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#60: Problems on localhost with getDomain() function in class.session.php

If you are working on a perfectly configured localhost (using domain names for development), you will find problems with the “localhost detection” part of the getDomain function, which will circumvent the right domain name (without any www prefix) to be returned.

if(in_array($_SERVER['HTTP_HOST'], array('localhost', '127.0.0.1')) || $_SERVER['SERVER_ADDR'] == '127.0.0.1'){
    return NULL; // prevent problems on local setups
}

I remember that the second part $_SERVER['SERVER_ADDR'] == '127.0.0.1 was added because some people had problems on local servers. But to me this part does not make much sense. Everything works as intended if I remove it. So I propose to use this instead:

if(in_array($_SERVER['HTTP_HOST'], array('localhost', '127.0.0.1'))){
    return NULL; // prevent problems on local setups
}

The second part was added when developing using MAMP. Seemingly it was only Firefox that required this! Very odd. Firefox would not instantiate the session_start() on the server without this code.

We should try and find a different solution for the Firefox problem. It should be possible to use HTTP hosts on a local environment. Unfortunately, I have no idea at the moment.

A bug very much related to this one, can read about it here, has been fixed. As for removing $_SERVER['SERVER_ADDR'] == '127.0.0.1', I’ll need to do some more investigation. I’ve not noticed any problems.

The problem to me was that the second part will always be true on localhost, which will prohibit the subsequent code for (virtual) host names to work. If one is using virtual hosts for development (and indeed I’d strongly recommend this), Symphony should work just the same as on a “live” server.

You’re right, the 2nd part will always be true on localhost, however, without it, it is not possible to log in via Firefox. I am not aware of any other work around for FF.

Does this thread shed any more light on the issue?

Nope. I made some tests and moved Symphony 2.0.7 around on my local development environment (editing the .htaccess file, of course):

  • http://localhost/
  • http://localhost/folder/
  • http://myvirtualhost/
  • http://myvirtualhost/folder/

I could login to any of these — so in my eyes this bug does no longer exist. I have no idea why.

[EDIT]: Accidental double post…

Going to close this in light of michael-e’s response. Please resurrect this issue if this re-emerges.

This issue is closed.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details