Visit http://localhost:8888/w/index.php/Special:Gather/by/Jdlrobson
Notice: Undefined property: Gather\models\CollectionsList::$mode in /Users/jrobson/git/core/extensions/Gather/includes/models/CollectionsList.php on line 240
Visit http://localhost:8888/w/index.php/Special:Gather/by/Jdlrobson
Notice: Undefined property: Gather\models\CollectionsList::$mode in /Users/jrobson/git/core/extensions/Gather/includes/models/CollectionsList.php on line 240
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Make sure mode is always set to avoid php warnings | mediawiki/extensions/Gather | master | +1 -0 |
Does the warning message show up on the page? Should I set some debug key to true to see this?
Change 219958 had a related patch set uploaded (by Jdlrobson):
Make sure mode is always set to avoid php warnings
Change 219958 merged by jenkins-bot:
Make sure mode is always set to avoid php warnings
tl;dr: The fix is OK.
This could have done with a little more investigation into the underlying problem: it seems like a CollectionsList model is being initialised but never having its mode set and then being rendered.
The /by/<user> route is handled by SpecialGather#renderUserCollectionsList, which calls CollectionsList::newFromApi (with $mode defaulting to null). Regardless of what happens in the body of ::newFromApi, the result never has its mode set, despite an empty string being calculated as its default.
… the fix is OK as '' is a sensible default for mode and now clients don't explicitly have to set it.
Note the fix is needed as getMode is being called before setMode
Certain collections do not care about mode. This is why the issue was happening. No investigation needed. The line you point to is an API parameter and not the same as the internal protected property.
Certain collections do not care about mode.
This kind of information would have been useful in reproducing the bug/demonstrating that your patch fixed the bug/for posterity. Could you provide more detail next time around?
The line you point to is an API parameter and not the same as the internal protected property.
I missed that the meaning $mode was overloaded there. Mibad. Though, why is $mode reassigned if it's falsy? I guess it doesn't matter.