aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2010-08-04 12:35:19 +0200
committerAndreas Fischer <bantu@phpbb.com>2010-08-04 12:35:19 +0200
commitdd63f57344321a47eac235005ff9975aafa3051e (patch)
treecbfc395dbf5af3d166ae6e64e8d5921d26208c04
parente1328e87ce23245dbd55a08fbaf3d48e957a6777 (diff)
downloadforums-dd63f57344321a47eac235005ff9975aafa3051e.tar
forums-dd63f57344321a47eac235005ff9975aafa3051e.tar.gz
forums-dd63f57344321a47eac235005ff9975aafa3051e.tar.bz2
forums-dd63f57344321a47eac235005ff9975aafa3051e.tar.xz
forums-dd63f57344321a47eac235005ff9975aafa3051e.zip
[ticket/9615] magic_quotes_gpc: call stripslashes() before utf8_basename()
When magic_quotes_gpc is 'On' it also affects the $_FILES array and a filename like 'bantu"s testfile.txt' will be returned as 'bantu\"s testfile.txt'. Because utf8_basename() also strips off anything before the last backslash the filename was returned as '"s testfile.txt'. Calling stripslashes() before utf8_basename() solves the problem. PHPBB3-9615
-rw-r--r--phpBB/includes/functions_upload.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 51fed45ebd..7f09cc1640 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -58,8 +58,9 @@ class filespec
$this->filename = $upload_ary['tmp_name'];
$this->filesize = $upload_ary['size'];
- $name = trim(utf8_htmlspecialchars(utf8_basename($upload_ary['name'])));
- $this->realname = $this->uploadname = (STRIP) ? stripslashes($name) : $name;
+ $name = (STRIP) ? stripslashes($upload_ary['name']) : $upload_ary['name'];
+ $name = trim(utf8_htmlspecialchars(utf8_basename($name)));
+ $this->realname = $this->uploadname = $name;
$this->mimetype = $upload_ary['type'];
// Opera adds the name to the mime type