New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work on determination of "base_url" config item #2981
Conversation
vlakoff
commented
Mar 31, 2014
- A little refactoring.
- Remove the basename only at the end, to avoid edge cases.
Put the $_SERVER['HTTP_HOST'] fallback in a more logical place.
Remove the basename only at the end, to avoid edge cases.
Better performance by not using regex.
Also, shouldn't we remove the manual setting of this config item? |
It's not unnecessary, it's a must. This auto-detection is a fallback that no serious application should really use - it's not reliable. What are the benefits from your refactoring? |
The refactoring won't change anything in practice, but that's because the edit: It looks like the autodetection would need some work to be usable in CLI. |
I'm not really sure I understand you ... I don't see how it can be made more useful since it is based on an HTTP header. Also, why is that test "unfit"? :) |
I thought of it as useless, because making sense only on a local server and using a HTTP 1.0 client. However I didn't think about CLI at the beginning. Straight to the point, considering the results of autodetection in CLI, and my refactoring not improving that situation, I'd suggest leaving that part out, opening a new PR with only the changes of 2516f3b + 93836ff. Is this OK for you? |
Ignore CLI, it's natural that you don't have a base URL under CLI. I'm still having a hard time understanding what you're trying to solve here though? Is this a performance improvement? Or fixing unexpected behavior? |
It's in case the script name would be in the path too. Yes, this is veeery unlikely, but I think a robust code should not rely on unlikeliness. |
Hehe, I'd sure would love to see who has their directory named 'index.php'. ;) But ok ... it makes sense. Just a few tips:
|
per request
This one is great because we don't have to deal with the special cases: * in Windows, dirname('/foo/index.php') gives "/foo", but dirname('/index.php') gives "\" instead of "/" * dirname() doesn't include the trailing slash, with the expection of "/" (root) props @narfbg
No, this one is fine. :) |
Work on determination of "base_url" config item
lines 89 & 90 are not needed anymore in Config_test.php |
They are. |
These are already defined in line 70-72 am I missing something? |
Yes, you are. :) |
Just noticed it, You're modifying the _SERVER |