Page MenuHomePhabricator

PHP Notice when uploading a file: "Undefined property: SpecialUpload::$mUploadDescription"
Open, Needs TriagePublic

Description

I did a mass export and import of pages between two wikis (MW 1.28). The pages in NS_IMAGE were created without their files, so I re-uploaded them manually with the same name. At this stage, the extension generated this notice:
`
Notice : Undefined property: SpecialUpload::$mUploadDescription in .../extensions/SelectCategory/SelectCategory_body.php on line 165
`

Event Timeline

Aklapper renamed this task from PHP Notice when uploading a file to PHP Notice when uploading a file: "Undefined property: SpecialUpload::$mUploadDescription".Jun 7 2017, 9:58 AM
Kizule subscribed.

I can't find related line in code, this should be tested.

I can't find related line in code

@Zoranzoki21: Huh, why not? Did you actually check the source code?
https://phabricator.wikimedia.org/diffusion/ESLC/browse/REL1_28/SelectCategory_body.php$165 is already mentioned in the task description and has that line.
It is the same in the master branch at https://phabricator.wikimedia.org/diffusion/ESLC/browse/master/SelectCategory_body.php$145

I can't find related line in code

@Zoranzoki21: Huh, why not? Did you actually check the source code?
https://phabricator.wikimedia.org/diffusion/ESLC/browse/REL1_28/SelectCategory_body.php$165 is already mentioned in the task description and has that line.
It is the same in the master branch at https://phabricator.wikimedia.org/diffusion/ESLC/browse/master/SelectCategory_body.php$145

Uhh, my mistake.

ashley subscribed.

This is easy enough to fix by just removing the offending line of code (and the associated code comments, for completeness):

diff --git a/SelectCategory_body.php b/SelectCategory_body.php
index 2ef5b31..fe110eb 100644
--- a/SelectCategory_body.php
+++ b/SelectCategory_body.php
@@ -219,11 +219,6 @@ class SelectCategory {
 
                        # If it is an upload we have to call a different method
                        if ( $isUpload ) {
-                               # mUploadDescription has been renamed to mComment (not sure in which version,
-                               # https://www.mediawiki.org/wiki/Extension_talk:SelectCategoryTagCloud says it
-                               # happened in 1.13 alpha or before, but I didn't confirm that).
-                               # mUploadDescription is kept for backwards compability.
-                               $pageObj->mUploadDescription .= $text;
                                $pageObj->mComment .= $text;
                        } else {
                                $pageObj->textbox1 .= $text;

mw:Release notes/1.13 specifies that the latest entry in the 1.13.x series of MediaWiki releases was made in February 2009, which is now well over 15 years ago, so there's literally zero sense in keeping such "backwards-compatibility" things around, when other parts of the extension have changed more than enough that you can't run the code on MW 1.13 anyway.

If no-one else beats me to it, I'll probably do this after getting the existing modernization patches already in gerrit (460725 and 730400) merged.

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly pointed to the codebase URL and provide clear steps to help a contributor get setup for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3