mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 11:13:59 +02:00
Merge pull request #1290 from nickvergessen/ticket/11362
Correctly sanitise the directory path in finder
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_extension_finder_test extends phpbb_test_case
|
||||
{
|
||||
@@ -142,13 +143,28 @@ class phpbb_extension_finder_test extends phpbb_test_case
|
||||
);
|
||||
}
|
||||
|
||||
public function test_uncleansub_directory_get_classes()
|
||||
{
|
||||
$classes = $this->finder
|
||||
->directory('/sub/../sub/type')
|
||||
->get_classes();
|
||||
|
||||
sort($classes);
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'phpbb_ext_foo_sub_type_alternative',
|
||||
),
|
||||
$classes
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* These do not work because of changes with PHPBB3-11386
|
||||
* They do not seem neccessary to me, so I am commenting them out for now
|
||||
public function test_get_classes_create_cache()
|
||||
{
|
||||
$cache = new phpbb_mock_cache;
|
||||
$finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/', $cache, '.php', '_custom_cache_name');
|
||||
$finder = new phpbb_extension_finder($this->extension_manager, new phpbb_filesystem(), dirname(__FILE__) . '/', $cache, '.php', '_custom_cache_name');
|
||||
$files = $finder->suffix('_class.php')->get_files();
|
||||
|
||||
$expected_files = array(
|
||||
@@ -188,6 +204,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
|
||||
|
||||
$finder = new phpbb_extension_finder(
|
||||
$this->extension_manager,
|
||||
new phpbb_filesystem(),
|
||||
dirname(__FILE__) . '/',
|
||||
new phpbb_mock_cache(array(
|
||||
'_ext_finder' => array(
|
||||
|
@@ -112,6 +112,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
|
||||
$db,
|
||||
$config,
|
||||
$migrator,
|
||||
new phpbb_filesystem(),
|
||||
'phpbb_ext',
|
||||
dirname(__FILE__) . '/',
|
||||
'.' . $php_ext,
|
||||
|
@@ -64,6 +64,7 @@ class metadata_manager_test extends phpbb_database_test_case
|
||||
$this->db,
|
||||
$this->config,
|
||||
$this->migrator,
|
||||
new phpbb_filesystem(),
|
||||
'phpbb_ext',
|
||||
$this->phpbb_root_path,
|
||||
$this->phpEx,
|
||||
|
Reference in New Issue
Block a user