Fixing realpath issues for provider returning the passed value instead of disabling it. This fixes issues with confirm boxes for those hosted on Network Solutions for example. - #20435

many thanks to the reporter for allowing me to debug this on his server. :)

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8355 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2008-01-30 19:30:58 +00:00
parent 35ae4c420f
commit f24069d32c
2 changed files with 176 additions and 160 deletions

View file

@ -113,6 +113,7 @@
<li>[Fix] Tiny code fixes (Bug #20165, #20025, #19795, #14804)</li> <li>[Fix] Tiny code fixes (Bug #20165, #20025, #19795, #14804)</li>
<li>[Fix] Prepend phpbb_root_path to ranks path for displaying ranks (Bug #19075)</li> <li>[Fix] Prepend phpbb_root_path to ranks path for displaying ranks (Bug #19075)</li>
<li>[Fix] Allow forum notifications if topic notifications are disabled but forum notifications enabled (Bug #14765)</li> <li>[Fix] Allow forum notifications if topic notifications are disabled but forum notifications enabled (Bug #14765)</li>
<li>[Fix] Fixing realpath issues for provider returning the passed value instead of disabling it. This fixes issues with confirm boxes for those hosted on Network Solutions for example. (Bug #20435)</li>
</ul> </ul>
<a name="v30rc8"></a><h3>1.i. Changes since 3.0.RC8</h3> <a name="v30rc8"></a><h3>1.i. Changes since 3.0.RC8</h3>

View file

@ -523,8 +523,6 @@ if (!function_exists('stripos'))
} }
} }
if (!function_exists('realpath'))
{
/** /**
* Checks if a path ($path) is absolute or relative * Checks if a path ($path) is absolute or relative
* *
@ -542,7 +540,7 @@ if (!function_exists('realpath'))
* @param string $path The path which we should attempt to resolve. * @param string $path The path which we should attempt to resolve.
* @return mixed * @return mixed
*/ */
function phpbb_realpath($path) function phpbb_own_realpath($path)
{ {
// Now to perform funky shizzle // Now to perform funky shizzle
@ -692,8 +690,8 @@ if (!function_exists('realpath'))
return $resolved; // We got here, in the end! return $resolved; // We got here, in the end!
} }
}
else if (!function_exists('realpath'))
{ {
/** /**
* A wrapper for realpath * A wrapper for realpath
@ -701,15 +699,32 @@ else
*/ */
function phpbb_realpath($path) function phpbb_realpath($path)
{ {
$path = realpath($path); return phpbb_own_realpath($path);
}
// Check for DIRECTORY_SEPARATOR at the end (and remove it!) }
if (substr($path, -1) == DIRECTORY_SEPARATOR) else
{ {
return substr($path, 0, -1); /**
* A wrapper for realpath
*/
function phpbb_realpath($path)
{
$realpath = realpath($path);
// Strangely there are provider not disabling realpath but returning strange values. :o
// We at least try to cope with them.
if ($realpath === $path || $realpath === false)
{
return phpbb_own_realpath($path);
} }
return $path; // Check for DIRECTORY_SEPARATOR at the end (and remove it!)
if (substr($realpath, -1) == DIRECTORY_SEPARATOR)
{
$realpath = substr($realpath, 0, -1);
}
return $realpath;
} }
} }