Page MenuHomePhabricator

Find out if there's a plan to get rid of using globals in PHP code
Open, Needs TriagePublic

Description

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

Jrbranaa created this task.Mar 6 2018, 11:22 PM
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)