Why: * ServiceWiring.php is documented to say that "Services MUST NOT vary their behaviour on the global state, especially not ... RequestContext ... or ... "current" user" ** However, the constructor of the CommentParserFactory calls `RequestContext::getMain()->getLanguage()` which is in violation of this rule by both using the RequestContext and being controlled by the state of the "current" user. * This has caused issues with premature access to the session user as demonstrated in T397900. ** Specifically, the call to ::getLanguage will load the request user's preferences and then as part of this checks if the user is named (which will load the User object). * Instead of using the incorrect method of getting the user's language, it should instead be fetched in CommentParserFactory::create. ** This will also allow the Language associated with the main request to change without leaving the service with an outdated and stale version of the user's Language object. What: * Update CommentParserFactory to call `RequestContext::getMain() ->getLanguage()` in the ::create method instead of getting it from the constructor. * Remove the call to `RequestContext::getMain()->getLanguage()` in ServiceWiring.php as no longer needed. * Update the unit test to instead be an integration test due to ::create now calling code which uses the service container. Bug: T397900 Change-Id: I36c9d8650eb5040f94626fa50f90b8026d3c3fe9 (cherry picked from commit 536f41bce51ca67733c4879d17992ee0b0db1de8) |
||
|---|---|---|
| .phan | ||
| cache | ||
| docs | ||
| extensions | ||
| images | ||
| includes | ||
| languages | ||
| maintenance | ||
| mw-config | ||
| resources | ||
| skins | ||
| tests | ||
| vendor@ff925b8b4d | ||
| .dockerignore | ||
| .editorconfig | ||
| .eslintignore | ||
| .eslintrc.json | ||
| .fresnel.yml | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmessage | ||
| .gitmodules | ||
| .gitreview | ||
| .mailmap | ||
| .phpcs.xml | ||
| .stylelintrc.json | ||
| .svgo.config.js | ||
| .vsls.json | ||
| api.php | ||
| autoload.php | ||
| CODE_OF_CONDUCT.md | ||
| composer.json | ||
| composer.local.json-sample | ||
| COPYING | ||
| CREDITS | ||
| DEVELOPERS.md | ||
| docker-compose.yml | ||
| FAQ | ||
| Gruntfile.js | ||
| HISTORY | ||
| img_auth.php | ||
| index.php | ||
| INSTALL | ||
| jsdoc.json | ||
| load.php | ||
| opensearch_desc.php | ||
| package-lock.json | ||
| package.json | ||
| phpunit.xml.dist | ||
| README.md | ||
| RELEASE-NOTES-1.43 | ||
| rest.php | ||
| SECURITY | ||
| thumb.php | ||
| thumb_handler.php | ||
| UPGRADE | ||
MediaWiki
MediaWiki is a free and open-source wiki software package written in PHP. It serves as the platform for Wikipedia and the other Wikimedia projects, used by hundreds of millions of people each month. MediaWiki is localised in over 350 languages and its reliability and robust feature set have earned it a large and vibrant community of third-party users and developers.
MediaWiki is:
- feature-rich and extensible, both on-wiki and with hundreds of extensions;
- scalable and suitable for both small and large sites;
- simple to install, working on most hardware/software combinations; and
- available in your language.
For system requirements, installation, and upgrade details, see the files RELEASE-NOTES, INSTALL, and UPGRADE.
- Ready to get started?
- Setting up your local development environment?
- Looking for the technical manual?
- Seeking help from a person?
- Looking to file a bug report or a feature request?
- Interested in helping out?
MediaWiki is the result of global collaboration and cooperation. The CREDITS file lists technical contributors to the project. The COPYING file explains MediaWiki's copyright and license (GNU General Public License, version 2 or later). Many thanks to the Wikimedia community for testing and suggestions.