Page MenuHomePhabricator

Find out if there's a plan to get rid of using globals in PHP code
Closed, ResolvedPublic


This task is a result from the 20180111-LegacyEncoding post mortem review meeting.

During our discussions about what led to this incident, it was mentioned that the continued dependency on global variables introduced testability constraints. This task is to investigate whether there are currently any tasks/plans to refactor this, e.g. by using more injection instead.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle renamed this task from Find out if there's an existing task/plan to get rid of globals. to Find out if there's a plan to get rid of using globals in PHP code.Mar 7 2018, 7:27 PM
Krinkle updated the task description. (Show Details)
Legoktm added a subscriber: Legoktm.

I don't think the problem in the LegacyEncoding incident would have been helped much if we weren't using global configuration settings. I think the main problem is that we have "LegacyEncoding" as an option instead of a maintenance script to reencode the rows/clean it up.

Generally people want to get rid of PHP globals, but there's no plan to do so. The ServiceWiring/MediaWikiServices/DI stuff makes it easier to hide the global variables to the point where the fact that they are technically global variables doesn't really matter that much. (wmf-config is an entirely different matter though)

I'm going to mark this as resolved, because the title of the task ("Find out if there's a plan") has been answered in T189059#4033153 with no follow-up questions. If more details are needed, please re-open.