[ticket/9930] Redirect failes with open_basedir enabled.

Open_basedir does not allow file_exists() for "." and directories without a
trayling-slash. Therefor we must append it on the check.

PHPBB3-9930
This commit is contained in:
Joas Schilling 2010-11-25 23:29:12 +01:00
parent f204ce6825
commit 5ec1c88795

View file

@ -2353,12 +2353,12 @@ function redirect($url, $return = false, $disable_cd_check = false)
// Relative uri // Relative uri
$pathinfo = pathinfo($url); $pathinfo = pathinfo($url);
if (!$disable_cd_check && !file_exists($pathinfo['dirname'])) if (!$disable_cd_check && !file_exists($pathinfo['dirname'] . '/'))
{ {
$url = str_replace('../', '', $url); $url = str_replace('../', '', $url);
$pathinfo = pathinfo($url); $pathinfo = pathinfo($url);
if (!file_exists($pathinfo['dirname'])) if (!file_exists($pathinfo['dirname'] . '/'))
{ {
// fallback to "last known user page" // fallback to "last known user page"
// at least this way we know the user does not leave the phpBB root // at least this way we know the user does not leave the phpBB root