aboutsummaryrefslogtreecommitdiffstats
path: root/tests/upload/filespec_test.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-04-11 21:08:15 +0200
committerMarc Alexander <admin@m-a-styles.de>2014-04-11 21:10:28 +0200
commit106be54de3e8295e74cf3ab27c6062993b2786e8 (patch)
treee3abd5267c76337ca276f5dd9b5ad8ae1131bfac /tests/upload/filespec_test.php
parent13a34ce59f2e39b3f74082737058251557fb600c (diff)
downloadforums-106be54de3e8295e74cf3ab27c6062993b2786e8.tar
forums-106be54de3e8295e74cf3ab27c6062993b2786e8.tar.gz
forums-106be54de3e8295e74cf3ab27c6062993b2786e8.tar.bz2
forums-106be54de3e8295e74cf3ab27c6062993b2786e8.tar.xz
forums-106be54de3e8295e74cf3ab27c6062993b2786e8.zip
[ticket/12211] Do not run attachment file names twice through htmlspecialchars
Upload filenames are already processed via htmlspecialchars in the type_cast_helper of the new request class. There is no need to run it through htmlspecialchars() again in the filespec class. PHPBB3-12211
Diffstat (limited to 'tests/upload/filespec_test.php')
-rw-r--r--tests/upload/filespec_test.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php
index 492f31cee6..2d46fd4058 100644
--- a/tests/upload/filespec_test.php
+++ b/tests/upload/filespec_test.php
@@ -273,4 +273,18 @@ class phpbb_filespec_test extends phpbb_test_case
$phpEx = '';
}
+
+ /**
+ * @dataProvider clean_filename_variables
+ */
+ public function test_uploadname($filename)
+ {
+ $type_cast_helper = new \phpbb\request\type_cast_helper();
+
+ $upload_name = '';
+ $type_cast_helper->set_var($upload_name, $filename, 'string', true, true);
+ $filespec = $this->get_filespec(array('name'=> $upload_name));
+
+ $this->assertSame(trim(utf8_basename(htmlspecialchars($filename))), $filespec->uploadname);
+ }
}