1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-06 06:25:04 +02:00

[ticket/13904] Use \phpbb\php\ini class for ini_get()

PHPBB3-13904
This commit is contained in:
Marc Alexander 2015-08-26 13:57:42 +02:00
parent 02f94b7527
commit cdde86ce7e
7 changed files with 65 additions and 39 deletions

@ -12,6 +12,7 @@ services:
scope: prototype scope: prototype
arguments: arguments:
- @filesystem - @filesystem
- @php_ini
- @language - @language
- %core.root_path% - %core.root_path%
- @mimetype.guesser - @mimetype.guesser
@ -23,6 +24,7 @@ services:
arguments: arguments:
- @filesystem - @filesystem
- @files.factory - @files.factory
- @php_ini
- @language - @language
- @request - @request
- %core.root_path% - %core.root_path%

@ -74,6 +74,15 @@ class filespec
*/ */
protected $filesystem; protected $filesystem;
/** @var \phpbb\php\ini ini_get() wrapper class */
protected $php_ini;
/** @var language Language class */
protected $language;
/** @var string phpBB root path */
protected $phpbb_root_path;
/** /**
* The plupload object * The plupload object
* @var \phpbb\plupload\plupload * @var \phpbb\plupload\plupload
@ -86,28 +95,24 @@ class filespec
*/ */
protected $mimetype_guesser; protected $mimetype_guesser;
/** @var language Language class */
protected $language;
/** @var string phpBB root path */
protected $phpbb_root_path;
/** /**
* File upload class * File upload class
* *
* @param \phpbb\filesystem\filesystem_interface $phpbb_filesystem Filesystem * @param \phpbb\filesystem\filesystem_interface $phpbb_filesystem Filesystem
* @param \phpbb\php\ini $php_ini ini_get() wrapper
* @param language $language Language * @param language $language Language
* @param string $phpbb_root_path phpBB root path * @param string $phpbb_root_path phpBB root path
* @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser * @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser
* @param \phpbb\plupload\plupload $plupload Plupload * @param \phpbb\plupload\plupload $plupload Plupload
*/ */
public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, \phpbb\php\ini $php_ini, language $language, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{ {
$this->plupload = $plupload;
$this->mimetype_guesser = $mimetype_guesser;
$this->filesystem = $phpbb_filesystem; $this->filesystem = $phpbb_filesystem;
$this->php_ini = $php_ini;
$this->language = $language; $this->language = $language;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->plupload = $plupload;
$this->mimetype_guesser = $mimetype_guesser;
} }
/** /**
@ -420,7 +425,7 @@ class filespec
return false; return false;
} }
$upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on') ? 'move' : 'copy'; $upload_mode = ($this->php_ini->get_bool('open_basedir') || $this->php_ini->get_bool('safe_mode')) ? 'move' : 'copy';
$upload_mode = ($this->local) ? 'local' : $upload_mode; $upload_mode = ($this->local) ? 'local' : $upload_mode;
$this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname); $this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname);

@ -56,6 +56,9 @@ class upload
/** @var \phpbb\files\factory Files factory */ /** @var \phpbb\files\factory Files factory */
protected $factory; protected $factory;
/** @var \phpbb\php\ini ini_get() wrapper */
protected $php_ini;
/** @var \phpbb\language\language Language class */ /** @var \phpbb\language\language Language class */
protected $language; protected $language;
@ -70,14 +73,16 @@ class upload
* *
* @param filesystem_interface $filesystem * @param filesystem_interface $filesystem
* @param factory $factory Files factory * @param factory $factory Files factory
* @param \phpbb\php\ini $php_ini ini_get() wrapper
* @param language $language Language class * @param language $language Language class
* @param request_interface $request Request class * @param request_interface $request Request class
* @param string $phpbb_root_path phpBB root path * @param string $phpbb_root_path phpBB root path
*/ */
public function __construct(filesystem_interface $filesystem, factory $factory, language $language, request_interface $request, $phpbb_root_path) public function __construct(filesystem_interface $filesystem, factory $factory, \phpbb\php\ini $php_ini, language $language, request_interface $request, $phpbb_root_path)
{ {
$this->filesystem = $filesystem; $this->filesystem = $filesystem;
$this->factory = $factory; $this->factory = $factory;
$this->php_ini = $php_ini;
$this->language = $language; $this->language = $language;
$this->request = $request; $this->request = $request;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
@ -211,7 +216,7 @@ class upload
switch ($errorcode) switch ($errorcode)
{ {
case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_INI_SIZE:
$max_filesize = @ini_get('upload_max_filesize'); $max_filesize = $this->php_ini->get_string('upload_max_filesize');
$unit = 'MB'; $unit = 'MB';
if (!empty($max_filesize)) if (!empty($max_filesize))

@ -23,6 +23,9 @@ class phpbb_files_upload_test extends phpbb_test_case
/** @var \phpbb\files\factory */ /** @var \phpbb\files\factory */
protected $factory; protected $factory;
/** @var \phpbb\php\ini */
protected $php_ini;
/** @var \phpbb\language\language */ /** @var \phpbb\language\language */
protected $language; protected $language;
@ -49,10 +52,12 @@ class phpbb_files_upload_test extends phpbb_test_case
$this->filesystem = new \phpbb\filesystem\filesystem(); $this->filesystem = new \phpbb\filesystem\filesystem();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \phpbb\php\ini;
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container->set('files.filespec', new \phpbb\files\filespec( $this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem, $this->filesystem,
$this->php_ini,
$this->language, $this->language,
$phpbb_root_path, $phpbb_root_path,
new \phpbb\mimetype\guesser(array( new \phpbb\mimetype\guesser(array(
@ -66,7 +71,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_reset_vars() public function test_reset_vars()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_max_filesize(500); $upload->set_max_filesize(500);
$this->assertEquals(500, $upload->max_filesize); $this->assertEquals(500, $upload->max_filesize);
$upload->reset_vars(); $upload->reset_vars();
@ -75,7 +80,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_set_disallowed_content() public function test_set_disallowed_content()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$disallowed_content = new ReflectionProperty($upload, 'disallowed_content'); $disallowed_content = new ReflectionProperty($upload, 'disallowed_content');
$disallowed_content->setAccessible(true); $disallowed_content->setAccessible(true);
@ -93,7 +98,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_is_valid() public function test_is_valid()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$this->assertFalse($upload->is_valid('foobar')); $this->assertFalse($upload->is_valid('foobar'));
} }
@ -116,7 +121,7 @@ class phpbb_files_upload_test extends phpbb_test_case
*/ */
public function test_assign_internal_error($error_code, $expected) public function test_assign_internal_error($error_code, $expected)
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$this->assertSame($expected, $upload->assign_internal_error($error_code)); $this->assertSame($expected, $upload->assign_internal_error($error_code));
} }
} }

@ -22,6 +22,9 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
/** @var \phpbb\files\factory */ /** @var \phpbb\files\factory */
protected $factory; protected $factory;
/** @var \phpbb\php\ini */
protected $php_ini;
/** @var \phpbb\language\language */ /** @var \phpbb\language\language */
protected $language; protected $language;
@ -51,9 +54,10 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
$this->filesystem = new \phpbb\filesystem\filesystem(); $this->filesystem = new \phpbb\filesystem\filesystem();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->request = $this->getMock('\phpbb\request\request'); $this->request = $this->getMock('\phpbb\request\request');
$this->php_ini = new \phpbb\php\ini;
$container = new phpbb_mock_container_builder(); $container = new phpbb_mock_container_builder();
$container->set('files.filespec', new \phpbb\files\filespec($this->filesystem, $this->language, $this->phpbb_root_path)); $container->set('files.filespec', new \phpbb\files\filespec($this->filesystem, $this->php_ini, $this->language, $this->phpbb_root_path));
$this->factory = new \phpbb\files\factory($container); $this->factory = new \phpbb\files\factory($container);
$container->set('files.factory', $this->factory); $container->set('files.factory', $this->factory);
$container->set('files.types.remote', new \phpbb\files\types\remote($this->factory, $this->language, $this->request, $phpbb_root_path)); $container->set('files.types.remote', new \phpbb\files\types\remote($this->factory, $this->language, $this->request, $phpbb_root_path));
@ -70,7 +74,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_invalid_extension() public function test_invalid_extension()
{ {
/** @var \phpbb\files\upload $upload */ /** @var \phpbb\files\upload $upload */
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_error_prefix('') $upload->set_error_prefix('')
->set_allowed_extensions(array('jpg')) ->set_allowed_extensions(array('jpg'))
->set_max_filesize(100); ->set_max_filesize(100);
@ -81,7 +85,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_empty_file() public function test_empty_file()
{ {
/** @var \phpbb\files\upload $upload */ /** @var \phpbb\files\upload $upload */
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_error_prefix('') $upload->set_error_prefix('')
->set_allowed_extensions(array('jpg')) ->set_allowed_extensions(array('jpg'))
->set_max_filesize(100); ->set_max_filesize(100);
@ -92,7 +96,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_successful_upload() public function test_successful_upload()
{ {
/** @var \phpbb\files\upload $upload */ /** @var \phpbb\files\upload $upload */
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_error_prefix('') $upload->set_error_prefix('')
->set_allowed_extensions(array('gif')) ->set_allowed_extensions(array('gif'))
->set_max_filesize(1000); ->set_max_filesize(1000);
@ -105,7 +109,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_too_large() public function test_too_large()
{ {
/** @var \phpbb\files\upload $upload */ /** @var \phpbb\files\upload $upload */
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_error_prefix('') $upload->set_error_prefix('')
->set_allowed_extensions(array('gif')) ->set_allowed_extensions(array('gif'))
->set_max_filesize(100); ->set_max_filesize(100);

@ -93,7 +93,7 @@ class phpbb_filespec_test extends phpbb_test_case
'error' => '', 'error' => '',
); );
$filespec = new \phpbb\files\filespec($this->filesystem, $this->language, $this->phpbb_root_path, $this->mimetype_guesser); $filespec = new \phpbb\files\filespec($this->filesystem, new \phpbb\php\ini, $this->language, $this->phpbb_root_path, $this->mimetype_guesser);
return $filespec->set_upload_ary(array_merge($upload_ary, $override)); return $filespec->set_upload_ary(array_merge($upload_ary, $override));
} }
@ -114,7 +114,7 @@ class phpbb_filespec_test extends phpbb_test_case
public function test_empty_upload_ary() public function test_empty_upload_ary()
{ {
$filespec = new \phpbb\files\filespec($this->filesystem, $this->language, $this->phpbb_root_path, $this->mimetype_guesser); $filespec = new \phpbb\files\filespec($this->filesystem, new \phpbb\php\ini, $this->language, $this->phpbb_root_path, $this->mimetype_guesser);
$this->assertInstanceOf('\phpbb\files\filespec', $filespec->set_upload_ary(array())); $this->assertInstanceOf('\phpbb\files\filespec', $filespec->set_upload_ary(array()));
$this->assertTrue($filespec->init_error()); $this->assertTrue($filespec->init_error());
} }
@ -262,7 +262,7 @@ class phpbb_filespec_test extends phpbb_test_case
*/ */
public function test_clean_filename_avatar($filename, $expected, $mode, $prefix = '', $user_id = '') public function test_clean_filename_avatar($filename, $expected, $mode, $prefix = '', $user_id = '')
{ {
$filespec = new \phpbb\files\filespec($this->filesystem, $this->language, $this->phpbb_root_path, $this->mimetype_guesser); $filespec = new \phpbb\files\filespec($this->filesystem, new \phpbb\php\ini, $this->language, $this->phpbb_root_path, $this->mimetype_guesser);
if ($filename) if ($filename)
{ {
@ -419,7 +419,7 @@ class phpbb_filespec_test extends phpbb_test_case
public function test_is_uploaded() public function test_is_uploaded()
{ {
$filespec = new \phpbb\files\filespec($this->filesystem, $this->language, $this->phpbb_root_path, null); $filespec = new \phpbb\files\filespec($this->filesystem, new \phpbb\php\ini, $this->language, $this->phpbb_root_path, null);
$reflection_filespec = new ReflectionClass($filespec); $reflection_filespec = new ReflectionClass($filespec);
$plupload_property = $reflection_filespec->getProperty('plupload'); $plupload_property = $reflection_filespec->getProperty('plupload');
$plupload_property->setAccessible(true); $plupload_property->setAccessible(true);

@ -27,6 +27,9 @@ class phpbb_fileupload_test extends phpbb_test_case
/** @var \phpbb\files\factory */ /** @var \phpbb\files\factory */
protected $factory; protected $factory;
/** @var \phpbb\php\ini */
protected $php_ini;
/** @var \phpbb\language\language */ /** @var \phpbb\language\language */
protected $language; protected $language;
@ -50,6 +53,7 @@ class phpbb_fileupload_test extends phpbb_test_case
$config['rand_seed_last_update'] = time() + 600; $config['rand_seed_last_update'] = time() + 600;
$this->request = $this->getMock('\phpbb\request\request'); $this->request = $this->getMock('\phpbb\request\request');
$this->php_ini = new \phpbb\php\ini;
$this->filesystem = new \phpbb\filesystem\filesystem(); $this->filesystem = new \phpbb\filesystem\filesystem();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
@ -66,13 +70,14 @@ class phpbb_fileupload_test extends phpbb_test_case
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container->set('files.filespec', new \phpbb\files\filespec( $this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem, $this->filesystem,
$this->php_ini,
$this->language, $this->language,
$phpbb_root_path, $phpbb_root_path,
new \phpbb\mimetype\guesser(array( new \phpbb\mimetype\guesser(array(
'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(),
)))); ))));
$this->factory = new \phpbb\files\factory($this->container); $this->factory = new \phpbb\files\factory($this->container);
$plupload = new \phpbb\plupload\plupload($phpbb_root_path, $config, $this->request, new \phpbb\user($this->language, '\phpbb\datetime'), new \phpbb\php\ini(), $this->mimetype_guesser); $plupload = new \phpbb\plupload\plupload($phpbb_root_path, $config, $this->request, new \phpbb\user($this->language, '\phpbb\datetime'), $this->php_ini, $this->mimetype_guesser);
$this->container->set('files.types.form', new \phpbb\files\types\form( $this->container->set('files.types.form', new \phpbb\files\types\form(
$this->factory, $this->factory,
$this->language, $this->language,
@ -111,7 +116,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_invalid_extension() public function test_common_checks_invalid_extension()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('png')) $upload->set_allowed_extensions(array('png'))
->set_max_filesize(100); ->set_max_filesize(100);
$file = $this->gen_valid_filespec(); $file = $this->gen_valid_filespec();
@ -121,10 +126,10 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_disallowed_content() public function test_common_checks_disallowed_content()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
$file = new \phpbb\files\filespec($this->filesystem, $this->language, $this->phpbb_root_path); $file = new \phpbb\files\filespec($this->filesystem, $this->php_ini, $this->language, $this->phpbb_root_path);
$file->set_upload_ary(array( $file->set_upload_ary(array(
'size' => 50, 'size' => 50,
'tmp_name' => dirname(__FILE__) . '/fixture/disallowed', 'tmp_name' => dirname(__FILE__) . '/fixture/disallowed',
@ -140,7 +145,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_invalid_filename() public function test_common_checks_invalid_filename()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100); ->set_max_filesize(100);
$file = $this->gen_valid_filespec(); $file = $this->gen_valid_filespec();
@ -151,7 +156,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_too_large() public function test_common_checks_too_large()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100); ->set_max_filesize(100);
$file = $this->gen_valid_filespec(); $file = $this->gen_valid_filespec();
@ -162,7 +167,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_valid_file() public function test_common_checks_valid_file()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
$file = $this->gen_valid_filespec(); $file = $this->gen_valid_filespec();
@ -172,7 +177,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_local_upload() public function test_local_upload()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
@ -186,7 +191,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file() public function test_move_existent_file()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
@ -200,7 +205,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file_overwrite() public function test_move_existent_file_overwrite()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
@ -215,7 +220,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_valid_dimensions() public function test_valid_dimensions()
{ {
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->php_ini, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(false) $upload->set_allowed_extensions(false)
->set_max_filesize(false) ->set_max_filesize(false)
->set_allowed_dimensions(1, 1, 100, 100); ->set_allowed_dimensions(1, 1, 100, 100);