[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
This commit is contained in:
Andreas Fischer 2010-08-04 12:35:19 +02:00
parent e1328e87ce
commit dd63f57344

View file

@ -58,8 +58,9 @@ class filespec
$this->filename = $upload_ary['tmp_name']; $this->filename = $upload_ary['tmp_name'];
$this->filesize = $upload_ary['size']; $this->filesize = $upload_ary['size'];
$name = trim(utf8_htmlspecialchars(utf8_basename($upload_ary['name']))); $name = (STRIP) ? stripslashes($upload_ary['name']) : $upload_ary['name'];
$this->realname = $this->uploadname = (STRIP) ? stripslashes($name) : $name; $name = trim(utf8_htmlspecialchars(utf8_basename($name)));
$this->realname = $this->uploadname = $name;
$this->mimetype = $upload_ary['type']; $this->mimetype = $upload_ary['type'];
// Opera adds the name to the mime type // Opera adds the name to the mime type