volomike / Faster

A Minimalist, Zero-Config PHP MVC Framework
27 stars 7 forks source link

Base URL Not Properly Discovered #15

Closed volomike closed 13 years ago

volomike commented 13 years ago

I found one really strange web host where the base URL was not properly discovered. This was due to a wacky configuration where the $_SERVER['DOCUMENT_ROOT'] parameter was not returning the proper result.

This led me to discover a really bad couple of lines in index.php, which I should never have done. These are the only lines that deal with DOCUMENT_ROOT. The line looks like this:

$sPath = str_replace('\\', '/', substr(dirname(__FILE__), strlen($_SERVER['DOCUMENT_ROOT'])));

As you can see, that's kind of a blind line -- super risky!

The fix is to replace that line with this:

$sPath = str_replace('index.php','',$_SERVER['SCRIPT_NAME']);

It is in the baseurl() and the getPath() functions.

volomike commented 13 years ago

I'm going to go ahead and change 1.036 with this change since it is so urgent. However, it will also be properly placed into the 1.037 version soon too.

volomike commented 13 years ago

Fixed in 1.0361.