GSoC/GCI Archive
Google Code-in 2013 Wikimedia

MediaWiki: UploadBase::checkWarnings could throw exception on null object access

completed by: Mayank Madan

mentors: Quim Gil

MediaWiki core has this little problem that you could fix:

The function checkWarnings() in UploadBase.php calls:

    $localFile = $this->getLocalFile();
    $filename = $localFile->getName();

But getLocalFile() will return null if the title of the upload is invalid for
some reason (like it contains a blacklisted extension). This can cause an
exception to be thrown. There should be a null check in there.
See 
Bug 38222 - UploadBase::checkWarnings could throw exception on null object access

Please ask any questions in the bug report. You will have better chances for quicker and better answers from the project maintainers and other community contributors.

Students are required to read Wikimedia's general instructions first. Patches should be submitted to Gerrit and reference the bug report in the commit message. Improvements to an initial patch must be submitted as an amendment  to the initial patch, not as new patches.