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,27 +523,25 @@ if (!function_exists('stripos'))
} }
} }
if (!function_exists('realpath')) /**
* Checks if a path ($path) is absolute or relative
*
* @param string $path Path to check absoluteness of
* @return boolean
*/
function is_absolute($path)
{ {
/**
* Checks if a path ($path) is absolute or relative
*
* @param string $path Path to check absoluteness of
* @return boolean
*/
function is_absolute($path)
{
return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:/#i', $path))) ? true : false; return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:/#i', $path))) ? true : false;
} }
/** /**
* @author Chris Smith <chris@project-minerva.org> * @author Chris Smith <chris@project-minerva.org>
* @copyright 2006 Project Minerva Team * @copyright 2006 Project Minerva Team
* @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
// Switch to use UNIX slashes // Switch to use UNIX slashes
@ -691,9 +689,9 @@ 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
{
/**
* A wrapper for realpath
*/
function phpbb_realpath($path)
{ {
return substr($path, 0, -1); $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;
} }
} }