wiki.techinc.nl/tests
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
..
api-testing block: Fix DBS::acquireTarget() race using GET_LOCK() 2025-04-07 11:43:34 +00:00
common SECURITY: Message: Don’t call is_callable() on strings 2024-10-26 21:41:52 +00:00
jest mediawiki.special.block: "Editing their own talk page" is inverted 2024-10-21 09:42:47 -07:00
parser Sync up core repo with Parsoid 2025-06-03 17:36:27 -04:00
phan Add @phan-mandatory-param for function name arguments 2024-09-20 16:23:17 +00:00
phpunit Don't use RequestContext in CommentParserFactory construction 2025-08-19 13:01:22 +00:00
qunit mw.jqueryMsg: Allow complex expressions in parser functions' first param 2024-11-12 14:21:26 +00:00
selenium selenium: Fix 'Page should be editable' 2024-10-08 15:06:39 +00:00
uidesign
.htaccess In .htaccess deny files, use "Satisfy All" 2025-04-04 13:17:15 +00:00