diff options
Diffstat (limited to 'phpBB/phpbb/class_loader.php')
-rw-r--r-- | phpBB/phpbb/class_loader.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php index 37b62fff24..cfdcc2af0b 100644 --- a/phpBB/phpbb/class_loader.php +++ b/phpBB/phpbb/class_loader.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,8 +23,6 @@ namespace phpbb; * * If every part of the class name is a directory, the last directory name is * also used as the filename, e.g. phpbb_dir would resolve to dir/dir.php. -* -* @package phpBB3 */ class class_loader { @@ -142,7 +144,13 @@ class class_loader */ public function load_class($class) { - $class = '\\' . $class; + // In general $class is not supposed to contain a leading backslash, + // but sometimes it does. See tickets PHP-50731 and HHVM-1840. + if ($class[0] !== '\\') + { + $class = '\\' . $class; + } + if (substr($class, 0, strlen($this->namespace)) === $this->namespace) { $path = $this->resolve_path($class); |