Avoid passing anything but a string to Title::newFromText in UploadBase::getTitle
authorAlex Monk <krenair@gmail.com>
Sun, 23 Aug 2015 15:22:07 +0000 (16:22 +0100)
committerAlex Monk <krenair@gmail.com>
Sun, 23 Aug 2015 18:27:40 +0000 (19:27 +0100)
Bug: T109974
Change-Id: I54d42bcdcb95cb5b6a09c1c3bdea8891a14a7fdb

includes/upload/UploadBase.php

index 493df2e..b06b91e 100644 (file)
@@ -752,6 +752,12 @@ abstract class UploadBase {
                if ( $this->mTitle !== false ) {
                        return $this->mTitle;
                }
+               if ( !is_string( $this->mDesiredDestName ) ) {
+                       $this->mTitleError = self::ILLEGAL_FILENAME;
+                       $this->mTitle = null;
+
+                       return $this->mTitle;
+               }
                /* Assume that if a user specified File:Something.jpg, this is an error
                 * and that the namespace prefix needs to be stripped of.
                 */