[ticket/17201] Do not run dirname() on dir path during install redirect

PHPBB3-17201
This commit is contained in:
Marc Alexander 2023-10-22 20:46:29 +02:00
parent 7e6c5df710
commit 70ba9dac03
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -58,7 +58,7 @@ if (!defined('PHPBB_INSTALLED'))
}
// $phpbb_root_path accounts for redirects from e.g. /adm
$script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $phpEx;
$script_path = trim(substr($script_name, -1) !== '/' ? dirname($script_name) : $script_name) . '/' . $phpbb_root_path . 'install/app.' . $phpEx;
// Replace any number of consecutive backslashes and/or slashes with a single slash
// (could happen on some proxy setups and/or Windows servers)
$script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);