From b1755d9daca435934b4a5928211b319abf67a810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 27 Jun 2017 11:47:25 +0200 Subject: [PATCH] [ticket/15253] Update imports PHPBB3-15253 --- phpBB/phpbb/composer/installer.php | 3 +- phpBB/phpbb/di/container_builder.php | 3 +- phpBB/phpbb/di/extension/core.php | 3 +- phpBB/phpbb/extension/di/extension_base.php | 3 +- phpBB/phpbb/filesystem/filesystem.php | 29 ++++++++++--------- phpBB/phpbb/finder.php | 4 ++- phpBB/phpbb/install/helper/database.php | 3 +- phpBB/phpbb/path_helper.php | 12 ++++---- phpBB/phpbb/routing/file_locator.php | 3 +- phpBB/phpbb/routing/helper.php | 3 +- phpBB/phpbb/session.php | 8 +++-- phpBB/phpbb/template/asset.php | 6 ++-- phpBB/phpbb/template/twig/loader.php | 8 +++-- phpBB/phpbb/viewonline_helper.php | 4 ++- .../ext/vendor/enabled_4/di/extension.php | 3 +- tests/filesystem/helper_clean_path_test.php | 4 ++- tests/filesystem/helper_is_absolute_test.php | 4 ++- tests/filesystem/helper_realpath_test.php | 6 ++-- tests/path_helper/path_helper_test.php | 6 ++-- tests/template/includephp_test.php | 4 ++- 20 files changed, 75 insertions(+), 44 deletions(-) diff --git a/phpBB/phpbb/composer/installer.php b/phpBB/phpbb/composer/installer.php index e96a39c4b8..3a03e29ef5 100644 --- a/phpBB/phpbb/composer/installer.php +++ b/phpBB/phpbb/composer/installer.php @@ -29,6 +29,7 @@ use phpbb\exception\runtime_exception; use phpbb\filesystem\filesystem; use phpbb\request\request; use Seld\JsonLint\ParsingException; +use phpbb\filesystem\helper as filesystem_helper; /** * Class to install packages through composer while freezing core dependencies. @@ -108,7 +109,7 @@ class installer $this->root_path = $root_path; $this->request = $request; - putenv('COMPOSER_HOME=' . \phpbb\filesystem\helper::realpath($root_path) . '/store/composer'); + putenv('COMPOSER_HOME=' . filesystem_helper::realpath($root_path) . '/store/composer'); } /** diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index 307f03f072..d267b11820 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -24,6 +24,7 @@ use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Finder\Finder; use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; +use phpbb\filesystem\helper as filesystem_helper; class container_builder { @@ -179,7 +180,7 @@ class container_builder $this->register_ext_compiler_pass(); } - $loader = new YamlFileLoader($this->container, new FileLocator(\phpbb\filesystem\helper::realpath($this->get_config_path()))); + $loader = new YamlFileLoader($this->container, new FileLocator(filesystem_helper::realpath($this->get_config_path()))); $loader->load($this->container->getParameter('core.environment') . '/config.yml'); $this->inject_custom_parameters(); diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index e3c9967b7b..75a037871f 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -19,6 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use phpbb\filesystem\helper as filesystem_helper; /** * Container core extension @@ -53,7 +54,7 @@ class core extends Extension */ public function load(array $configs, ContainerBuilder $container) { - $loader = new YamlFileLoader($container, new FileLocator(\phpbb\filesystem\helper::realpath($this->config_path))); + $loader = new YamlFileLoader($container, new FileLocator(filesystem_helper::realpath($this->config_path))); $loader->load($container->getParameter('core.environment') . '/container/environment.yml'); $config = $this->getConfiguration($configs, $container); diff --git a/phpBB/phpbb/extension/di/extension_base.php b/phpBB/phpbb/extension/di/extension_base.php index a8f8ca0776..97033e7ddb 100644 --- a/phpBB/phpbb/extension/di/extension_base.php +++ b/phpBB/phpbb/extension/di/extension_base.php @@ -18,6 +18,7 @@ use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use phpbb\filesystem\helper as filesystem_helper; /** * Container core extension @@ -94,7 +95,7 @@ class extension_base extends Extension if ($services_directory && $services_file) { - $loader = new YamlFileLoader($container, new FileLocator(\phpbb\filesystem\helper::realpath($services_directory))); + $loader = new YamlFileLoader($container, new FileLocator(filesystem_helper::realpath($services_directory))); $loader->load($services_file); } } diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php index 01e0bb2cb2..80474cb0a2 100644 --- a/phpBB/phpbb/filesystem/filesystem.php +++ b/phpBB/phpbb/filesystem/filesystem.php @@ -13,6 +13,7 @@ namespace phpbb\filesystem; +use Symfony\Component\Filesystem\Exception\IOException; use phpbb\filesystem\exception\filesystem_exception; /** @@ -60,7 +61,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->chgrp($files, $group, $recursive); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { // Try to recover filename // By the time this is written that is at the end of the message @@ -146,7 +147,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->chown($files, $user, $recursive); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { // Try to recover filename // By the time this is written that is at the end of the message @@ -162,7 +163,7 @@ class filesystem implements filesystem_interface */ public function clean_path($path) { - return \phpbb\filesystem\helper::clean_path($path); + return helper::clean_path($path); } /** @@ -174,7 +175,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->copy($origin_file, $target_file, $override); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { throw new filesystem_exception('CANNOT_COPY_FILES', '', array(), $e); } @@ -189,7 +190,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->dumpFile($filename, $content); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { throw new filesystem_exception('CANNOT_DUMP_FILE', $filename, array(), $e); } @@ -208,7 +209,7 @@ class filesystem implements filesystem_interface */ public function is_absolute_path($path) { - return \phpbb\filesystem\helper::is_absolute_path($path); + return helper::is_absolute_path($path); } /** @@ -286,7 +287,7 @@ class filesystem implements filesystem_interface */ public function make_path_relative($end_path, $start_path) { - return \phpbb\filesystem\helper::make_path_relative($end_path, $start_path); + return helper::make_path_relative($end_path, $start_path); } /** @@ -298,7 +299,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->mirror($origin_dir, $target_dir, $iterator, $options); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { $msg = $e->getMessage(); $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); @@ -316,7 +317,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->mkdir($dirs, $mode); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { $msg = $e->getMessage(); $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); @@ -499,7 +500,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->remove($files); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { // Try to recover filename // By the time this is written that is at the end of the message @@ -519,7 +520,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->rename($origin, $target, $overwrite); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { $msg = $e->getMessage(); $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); @@ -537,7 +538,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->symlink($origin_dir, $target_dir, $copy_on_windows); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { throw new filesystem_exception('CANNOT_CREATE_SYMLINK', $origin_dir, array(), $e); } @@ -552,7 +553,7 @@ class filesystem implements filesystem_interface { $this->symfony_filesystem->touch($files, $time, $access_time); } - catch (\Symfony\Component\Filesystem\Exception\IOException $e) + catch (IOException $e) { // Try to recover filename // By the time this is written that is at the end of the message @@ -759,6 +760,6 @@ class filesystem implements filesystem_interface */ protected function resolve_path($path, $prefix = '', $absolute = false, $return_array = false) { - return \phpbb\filesystem\helper::resolve_path($path, $prefix, $absolute, $return_array); + return helper::resolve_path($path, $prefix, $absolute, $return_array); } } diff --git a/phpBB/phpbb/finder.php b/phpBB/phpbb/finder.php index 57ae046dc3..9c956c6179 100644 --- a/phpBB/phpbb/finder.php +++ b/phpBB/phpbb/finder.php @@ -13,6 +13,8 @@ namespace phpbb; +use phpbb\filesystem\helper as filesystem_helper; + /** * The finder provides a simple way to locate files in the core and a set of extensions */ @@ -241,7 +243,7 @@ class finder */ protected function sanitise_directory($directory) { - $directory = \phpbb\filesystem\helper::clean_path($directory); + $directory = filesystem_helper::clean_path($directory); $dir_len = strlen($directory); if ($dir_len > 1 && $directory[$dir_len - 1] === '/') diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index 6dbea3735c..7ea02a12a4 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -14,6 +14,7 @@ namespace phpbb\install\helper; use phpbb\install\exception\invalid_dbms_exception; +use phpbb\filesystem\helper as filesystem_helper; /** * Database related general functionality for installer @@ -329,7 +330,7 @@ class database // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea if ($dbms_info['SCHEMA'] === 'sqlite' - && stripos(\phpbb\filesystem\helper::realpath($dbhost), \phpbb\filesystem\helper::realpath($this->phpbb_root_path) === 0)) + && stripos(filesystem_helper::realpath($dbhost), filesystem_helper::realpath($this->phpbb_root_path) === 0)) { $errors[] = array( 'title' =>'INST_ERR_DB_FORUM_PATH', diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index 8abb62d511..0d5034024d 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -13,6 +13,8 @@ namespace phpbb; +use phpbb\filesystem\helper as filesystem_helper; + /** * A class with various functions that are related to paths, files and the filesystem */ @@ -112,7 +114,7 @@ class path_helper $path = substr($path, 8); } - return \phpbb\filesystem\helper::clean_path($web_root_path . $path); + return filesystem_helper::clean_path($web_root_path . $path); } return $path; @@ -158,7 +160,7 @@ class path_helper // We do not need to escape $path_info, $request_uri and $script_name because we can not find their content in the result. // Path info (e.g. /foo/bar) - $path_info = \phpbb\filesystem\helper::clean_path($this->symfony_request->getPathInfo()); + $path_info = filesystem_helper::clean_path($this->symfony_request->getPathInfo()); // Full request URI (e.g. phpBB/app.php/foo/bar) $request_uri = $this->symfony_request->getRequestUri(); @@ -173,7 +175,7 @@ class path_helper */ if ($path_info === '/' && preg_match('/app\.' . $this->php_ext . '\/$/', $request_uri)) { - return $this->web_root_path = \phpbb\filesystem\helper::clean_path('./../' . $this->phpbb_root_path); + return $this->web_root_path = filesystem_helper::clean_path('./../' . $this->phpbb_root_path); } /* @@ -230,7 +232,7 @@ class path_helper } // Prepend ../ to the phpbb_root_path as many times as / exists in path_info - $this->web_root_path = \phpbb\filesystem\helper::clean_path( + $this->web_root_path = filesystem_helper::clean_path( './' . str_repeat('../', $corrections) . $this->phpbb_root_path ); return $this->web_root_path; @@ -321,7 +323,7 @@ class path_helper // Add length of URL delimiter to position $path = substr($url, $delimiter_position + 3); - return $scheme . \phpbb\filesystem\helper::clean_path($path); + return $scheme . filesystem_helper::clean_path($path); } /** diff --git a/phpBB/phpbb/routing/file_locator.php b/phpBB/phpbb/routing/file_locator.php index cf4520ddae..bd2c1850bb 100644 --- a/phpBB/phpbb/routing/file_locator.php +++ b/phpBB/phpbb/routing/file_locator.php @@ -14,6 +14,7 @@ namespace phpbb\routing; use Symfony\Component\Config\FileLocator; +use phpbb\filesystem\helper as filesystem_helper; class file_locator extends FileLocator { @@ -24,7 +25,7 @@ class file_locator extends FileLocator foreach ($paths as $path) { - $absolute_paths[] = \phpbb\filesystem\helper::realpath($path); + $absolute_paths[] = filesystem_helper::realpath($path); } parent::__construct($absolute_paths); diff --git a/phpBB/phpbb/routing/helper.php b/phpBB/phpbb/routing/helper.php index 9c4ead98d2..3d38105aa3 100644 --- a/phpBB/phpbb/routing/helper.php +++ b/phpBB/phpbb/routing/helper.php @@ -15,6 +15,7 @@ namespace phpbb\routing; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RequestContext; +use phpbb\filesystem\helper as filesystem_helper; /** * Controller helper class, contains methods that do things for controllers @@ -133,7 +134,7 @@ class helper } } - $base_url = $this->request->escape(\phpbb\filesystem\helper::clean_path($base_url), true); + $base_url = $this->request->escape(filesystem_helper::clean_path($base_url), true); $context->setBaseUrl($base_url); diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 3a07fa8384..bb3dd01629 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -13,6 +13,8 @@ namespace phpbb; +use phpbb\filesystem\helper as filesystem_helper; + /** * Session class */ @@ -85,15 +87,15 @@ class session $page_name = (substr($script_name, -1, 1) == '/') ? '' : basename($script_name); $page_name = urlencode(htmlspecialchars($page_name)); - $symfony_request_path = \phpbb\filesystem\helper::clean_path($symfony_request->getPathInfo()); + $symfony_request_path = filesystem_helper::clean_path($symfony_request->getPathInfo()); if ($symfony_request_path !== '/') { $page_name .= str_replace('%2F', '/', urlencode($symfony_request_path)); } // current directory within the phpBB root (for example: adm) - $root_dirs = explode('/', str_replace('\\', '/', \phpbb\filesystem\helper::realpath($root_path))); - $page_dirs = explode('/', str_replace('\\', '/', \phpbb\filesystem\helper::realpath('./'))); + $root_dirs = explode('/', str_replace('\\', '/', filesystem_helper::realpath($root_path))); + $page_dirs = explode('/', str_replace('\\', '/', filesystem_helper::realpath('./'))); $intersection = array_intersect_assoc($root_dirs, $page_dirs); $root_dirs = array_diff_assoc($root_dirs, $intersection); diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php index 6acd816db5..fb70fbb24e 100644 --- a/phpBB/phpbb/template/asset.php +++ b/phpBB/phpbb/template/asset.php @@ -13,6 +13,8 @@ namespace phpbb\template; +use phpbb\filesystem\helper as filesystem_helper; + class asset { protected $components = array(); @@ -153,7 +155,7 @@ class asset public function set_path($path, $urlencode = false) { // Since 1.7.0 Twig returns the real path of the file. We need it to be relative. - $real_root_path = \phpbb\filesystem\helper::realpath($this->path_helper->get_phpbb_root_path()) . DIRECTORY_SEPARATOR; + $real_root_path = filesystem_helper::realpath($this->path_helper->get_phpbb_root_path()) . DIRECTORY_SEPARATOR; // If the asset is under the phpBB root path we need to remove its path and then prepend $phpbb_root_path if ($real_root_path && substr($path . DIRECTORY_SEPARATOR, 0, strlen($real_root_path)) === $real_root_path) @@ -163,7 +165,7 @@ class asset else { // Else we make the path relative to the current working directory - $real_root_path = \phpbb\filesystem\helper::realpath('.') . DIRECTORY_SEPARATOR; + $real_root_path = filesystem_helper::realpath('.') . DIRECTORY_SEPARATOR; if ($real_root_path && substr($path . DIRECTORY_SEPARATOR, 0, strlen($real_root_path)) === $real_root_path) { $path = str_replace('\\', '/', substr($path, strlen($real_root_path))); diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 121c93b170..607dfcd078 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -13,6 +13,8 @@ namespace phpbb\template\twig; +use phpbb\filesystem\helper as filesystem_helper; + /** * Twig Template loader */ @@ -49,7 +51,7 @@ class loader extends \Twig_Loader_Filesystem */ public function addSafeDirectory($directory) { - $directory = \phpbb\filesystem\helper::realpath($directory); + $directory = filesystem_helper::realpath($directory); if ($directory !== false) { @@ -89,7 +91,7 @@ class loader extends \Twig_Loader_Filesystem */ public function addPath($path, $namespace = self::MAIN_NAMESPACE) { - return parent::addPath(\phpbb\filesystem\helper::realpath($path), $namespace); + return parent::addPath(filesystem_helper::realpath($path), $namespace); } /** @@ -129,7 +131,7 @@ class loader extends \Twig_Loader_Filesystem // can now check if we're within a "safe" directory // Find the real path of the directory the file is in - $directory = \phpbb\filesystem\helper::realpath(dirname($file)); + $directory = filesystem_helper::realpath(dirname($file)); if ($directory === false) { diff --git a/phpBB/phpbb/viewonline_helper.php b/phpBB/phpbb/viewonline_helper.php index ee23190db8..8df1f484d8 100644 --- a/phpBB/phpbb/viewonline_helper.php +++ b/phpBB/phpbb/viewonline_helper.php @@ -13,6 +13,8 @@ namespace phpbb; +use phpbb\filesystem\helper as filesystem_helper; + /** * Class to handle viewonline related tasks */ @@ -33,7 +35,7 @@ class viewonline_helper */ public function get_user_page($session_page) { - $session_page = \phpbb\filesystem\helper::clean_path($session_page); + $session_page = filesystem_helper::clean_path($session_page); if (strpos($session_page, './') === 0) { $session_page = substr($session_page, 2); diff --git a/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php b/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php index cd94902276..2164077d8e 100644 --- a/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php +++ b/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php @@ -17,6 +17,7 @@ use phpbb\extension\di\extension_base; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use phpbb\filesystem\helper as filesystem_helper; /** * Container core extension @@ -25,7 +26,7 @@ class extension extends extension_base { protected function load_services(ContainerBuilder $container) { - $loader = new YamlFileLoader($container, new FileLocator(\phpbb\filesystem\helper::realpath($this->ext_path))); + $loader = new YamlFileLoader($container, new FileLocator(filesystem_helper::realpath($this->ext_path))); $loader->load('environment.yml'); } } diff --git a/tests/filesystem/helper_clean_path_test.php b/tests/filesystem/helper_clean_path_test.php index 21a4dfe238..6b723cbc50 100644 --- a/tests/filesystem/helper_clean_path_test.php +++ b/tests/filesystem/helper_clean_path_test.php @@ -11,6 +11,8 @@ * */ +use phpbb\filesystem\helper as filesystem_helper; + class phpbb_filesystem_helper_clean_path_test extends phpbb_test_case { @@ -47,6 +49,6 @@ class phpbb_filesystem_helper_clean_path_test extends phpbb_test_case */ public function test_clean_path($input, $expected) { - $this->assertEquals($expected, \phpbb\filesystem\helper::clean_path($input)); + $this->assertEquals($expected, filesystem_helper::clean_path($input)); } } diff --git a/tests/filesystem/helper_is_absolute_test.php b/tests/filesystem/helper_is_absolute_test.php index 52b5d9e1b9..6105f48ca0 100644 --- a/tests/filesystem/helper_is_absolute_test.php +++ b/tests/filesystem/helper_is_absolute_test.php @@ -11,6 +11,8 @@ * */ + use phpbb\filesystem\helper as filesystem_helper; + class phpbb_filesystem_helper_is_absolute_test extends phpbb_test_case { @@ -59,6 +61,6 @@ class phpbb_filesystem_helper_is_absolute_test extends phpbb_test_case */ public function test_is_absolute($path, $expected) { - $this->assertEquals($expected, \phpbb\filesystem\helper::is_absolute_path($path)); + $this->assertEquals($expected, filesystem_helper::is_absolute_path($path)); } } diff --git a/tests/filesystem/helper_realpath_test.php b/tests/filesystem/helper_realpath_test.php index 754d7631a4..7dde12e82f 100644 --- a/tests/filesystem/helper_realpath_test.php +++ b/tests/filesystem/helper_realpath_test.php @@ -11,6 +11,8 @@ * */ + use phpbb\filesystem\helper as filesystem_helper; + class phpbb_filesystem_helper_realpath_test extends phpbb_test_case { protected static $filesystem_helper_phpbb_own_realpath; @@ -19,7 +21,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case { parent::setUpBeforeClass(); - self::$filesystem_helper_phpbb_own_realpath = new ReflectionMethod('\phpbb\filesystem\helper', 'phpbb_own_realpath'); + self::$filesystem_helper_phpbb_own_realpath = new ReflectionMethod('filesystem_helper', 'phpbb_own_realpath'); self::$filesystem_helper_phpbb_own_realpath->setAccessible(true); } @@ -49,7 +51,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case return array(); } - $relative_path = \phpbb\filesystem\helper::make_path_relative(__DIR__, getcwd()); + $relative_path = filesystem_helper::make_path_relative(__DIR__, getcwd()); return array( array($relative_path, __DIR__), diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index 96b8460f04..f22606843c 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -11,6 +11,8 @@ * */ +use phpbb\filesystem\helper as filesystem_helper; + class phpbb_path_helper_test extends phpbb_test_case { /** @var \phpbb\path_helper */ @@ -43,7 +45,7 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function set_phpbb_root_path() { - $this->phpbb_root_path = \phpbb\filesystem\helper::clean_path(dirname(__FILE__) . '/../../phpBB/'); + $this->phpbb_root_path = filesystem_helper::clean_path(dirname(__FILE__) . '/../../phpBB/'); } public function test_get_web_root_path() @@ -72,7 +74,7 @@ class phpbb_path_helper_test extends phpbb_test_case ), array( $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', - \phpbb\filesystem\helper::clean_path($this->phpbb_root_path . $this->phpbb_root_path . 'test.php'), + filesystem_helper::clean_path($this->phpbb_root_path . $this->phpbb_root_path . 'test.php'), ), ); } diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index e156be5c23..baf2eed11b 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -11,6 +11,8 @@ * */ +use phpbb\filesystem\helper as filesystem_helper; + require_once dirname(__FILE__) . '/template_test_case.php'; class phpbb_template_includephp_test extends phpbb_template_template_test_case @@ -40,7 +42,7 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case global $phpbb_root_path; $path_to_php = str_replace('\\', '/', dirname(__FILE__)) . '/templates/_dummy_include.php.inc'; - $this->assertTrue(\phpbb\filesystem\helper::is_absolute_path($path_to_php)); + $this->assertTrue(filesystem_helper::is_absolute_path($path_to_php)); $template_text = "Path is absolute.\n"; $cache_dir = $phpbb_root_path . 'cache/';