Current configuration on the wiki
Find a file
Dreamy Jazz 05631d4fe4 Don't use RequestContext in CommentParserFactory construction
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)
2025-08-19 13:01:22 +00:00
.phan structure tests: allow PHP 8.1 syntax and autoload enums 2025-06-18 10:55:15 +01:00
cache In .htaccess deny files, use "Satisfy All" 2025-04-04 13:17:15 +00:00
docs [REST Sandbox] Remove SwaggerUI from MediaWiki Releases 2025-06-30 16:05:49 +01:00
extensions Update git submodules 2025-08-19 08:56:18 +00:00
images
includes Don't use RequestContext in CommentParserFactory construction 2025-08-19 13:01:22 +00:00
languages Localisation updates from https://translatewiki.net. 2025-08-19 10:42:25 +00:00
maintenance maintenance: Fix paging in findMissingFiles.php 2025-08-06 19:10:54 +00:00
mw-config installer: Fix class name in example override 2025-01-25 15:07:10 +00:00
resources docs: Add link to CORS setting for REST API 2025-07-16 11:53:21 +00:00
skins Update git submodules 2025-08-19 06:42:53 +00:00
tests Don't use RequestContext in CommentParserFactory construction 2025-08-19 13:01:22 +00:00
vendor@ff925b8b4d Update git submodules 2025-07-01 12:49:08 +00:00
.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 Cache: Move MessageCache hook interfaces into correct folder 2025-07-02 00:34:15 +01:00
CODE_OF_CONDUCT.md
composer.json composer.json: Replace away symfony php polyfills for PHP8/8.1 2025-07-01 12:51:43 +00:00
composer.local.json-sample
COPYING
CREDITS
DEVELOPERS.md
docker-compose.yml dev(docker): Bump mediawiki-web container to dev/bookworm-apache2:1.0.1 2025-01-07 17:02:36 +00:00
FAQ
Gruntfile.js
HISTORY
img_auth.php
index.php
INSTALL INSTALL: Document requirement for bcmath/gmp on 32-bit systems 2025-04-18 15:57:48 +00:00
jsdoc.json
load.php
opensearch_desc.php
package-lock.json
package.json
phpunit.xml.dist
README.md
RELEASE-NOTES-1.43 Start 1.43.4 2025-07-01 14:51:55 +01:00
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.

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.