diff options
| author | Nils Adermann <naderman@naderman.de> | 2013-09-17 16:15:44 +0200 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2013-09-17 16:15:44 +0200 |
| commit | c4b53490ad93566914cbc280910c67b75346a665 (patch) | |
| tree | 206652fbbe1a3d0f3871a5342eef0b519773a079 /phpBB | |
| parent | d12f35885539c8bd7d2d795d9fc5638d022698bb (diff) | |
| download | forums-c4b53490ad93566914cbc280910c67b75346a665.tar forums-c4b53490ad93566914cbc280910c67b75346a665.tar.gz forums-c4b53490ad93566914cbc280910c67b75346a665.tar.bz2 forums-c4b53490ad93566914cbc280910c67b75346a665.tar.xz forums-c4b53490ad93566914cbc280910c67b75346a665.zip | |
[ticket/11700] Correctly load extensions with nonprefixed namespaces
PHPBB3-11700
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/common.php | 2 | ||||
| -rw-r--r-- | phpBB/config/services.yml | 2 | ||||
| -rw-r--r-- | phpBB/download/file.php | 4 | ||||
| -rw-r--r-- | phpBB/includes/acp/acp_modules.php | 2 | ||||
| -rw-r--r-- | phpBB/install/index.php | 2 | ||||
| -rw-r--r-- | phpBB/phpbb/extension/finder.php | 13 | ||||
| -rw-r--r-- | phpBB/phpbb/extension/manager.php | 2 |
7 files changed, 14 insertions, 13 deletions
diff --git a/phpBB/common.php b/phpBB/common.php index 2fb832648a..4f2c9ea272 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -87,7 +87,7 @@ set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handle // Setup class loader first $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); -$phpbb_class_loader_ext = new \phpbb\class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); +$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); // Set up container diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 1dba6048e9..5edaa6c0fc 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -52,7 +52,7 @@ services: class_loader.ext: class: phpbb\class_loader arguments: - - phpbb\ext\ + - \ - %core.root_path%ext/ - %core.php_ext% calls: diff --git a/phpBB/download/file.php b/phpBB/download/file.php index f612d11d3c..04d68f6a48 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -50,9 +50,9 @@ if (isset($_GET['avatar'])) require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Setup class loader first - $phpbb_class_loader = new \phpbb\class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); + $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); - $phpbb_class_loader_ext = new \phpbb\class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); + $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); // Set up container diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 8aa72076da..6792886d2a 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -565,7 +565,7 @@ class acp_modules { // Skip entries we do not need if we know the module we are // looking for - if ($module && strpos($cur_module, $module) === false) + if ($module && strpos(str_replace('\\', '_', $cur_module), $module) === false) { continue; } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index ebfec4232f..bdc2e86c53 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -112,7 +112,7 @@ $phpbb_class_loader_new = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path} $phpbb_class_loader_new->register(); $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); -$phpbb_class_loader_ext = new \phpbb\class_loader('phpbb\\ext\\', "{$phpbb_root_path}ext/", $phpEx); +$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); // Set up container diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index 338f1cdeb9..d3e73bc387 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -277,15 +277,16 @@ class finder $classes = array(); foreach ($files as $file => $ext_name) { - if (preg_match('#^includes/#', $file)) + $class = substr($file, 0, -strlen('.' . $this->php_ext)); + if ($ext_name === '/' && preg_match('#^includes/#', $file)) { - $file = preg_replace('#^includes/#', '', $file); - $classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext))); + $class = preg_replace('#^includes/#', '', $class); + $classes[] = 'phpbb_' . str_replace('/', '_', $class); } else - { - $file = preg_replace('#^phpbb/#', '', $file); - $classes[] = 'phpbb\\' . str_replace('/', '\\', substr($file, 0, -strlen('.' . $this->php_ext))); + { + $class = preg_replace('#^ext/#', '', $class); + $classes[] = str_replace('/', '\\', $class); } } return $classes; diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index d174146f52..ce6d7e05c8 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -133,7 +133,7 @@ class manager */ public function get_extension($name) { - $extension_class_name = 'phpbb_ext_' . str_replace('/', '_', $name) . '_ext'; + $extension_class_name = str_replace('/', '\\', $name) . '\\ext'; $migrator = $this->container->get('migrator'); |
