Page MenuHomePhabricator

EventBusHooks::onArticleRevisionVisibilitySet should not create global functions
Closed, ResolvedPublic

Description

In the mediawiki/extensions/EventBus repository, there's a class called EventBusHooks, that has a function, onArticleRevisionVisibilitySet, which likely unintentionally creates new global functions.

In PHP, creating a function inside a class static function actually creates a global function (unlike JavaScript). https://3v4l.org/7tNtb

This should be switched to having private static helper functions instead of creating new global functions.

I'll mentor this for Google-Code-in-2017

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

By the way, I noticed that function onBlockIpComplete unintentionally creates new global function too. This will be also fixed in my patch.

Change 400571 had a related patch set uploaded (by Phantom42; owner: Phantom42):
[mediawiki/extensions/EventBus@master] Fix unintentionally created global functions in EventBusHooks

https://gerrit.wikimedia.org/r/400571

Change 400571 merged by jenkins-bot:
[mediawiki/extensions/EventBus@master] Fix unintentionally created global functions in EventBusHooks

https://gerrit.wikimedia.org/r/400571

In T183730#3862416, @Phantom42 wrote:

By the way, I noticed that function onBlockIpComplete unintentionally creates new global function too. This will be also fixed in my patch.

Awesome, thanks for taking care of that too!