Page MenuHomePhabricator

MWHttpRequest may have to require_once() GlobalFunctions.php
Closed, DeclinedPublic

Description

Author: raphael.droz

Description:
If

  • you attempt to MWHttpRequest::factory() (eg, during bootstrap, from an extension),
  • and you don't have curl (should I ?)

> then you're getting failures because wfIniGetBool() is not yet defined

There should be a way to require(GlobalFunctions.php) in such a case.

HTTP component set to "redirect", feel free to change this.


Version: 1.20.x
Severity: minor

Details

Reference
bz32477

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:59 PM
bzimport set Reference to bz32477.
bzimport added a subscriber: Unknown Object (MLST).

Are you using MWHttpRequest::factory() directly in the extension setup code? If so, suggest WONTFIX. It's expected that not everything are initialized at that time. There's also a [[mw:Manual:$wgExtensionFunctions]] for code which requires a fully initialized environment.

raphael.droz wrote:

But shouldn't Auth-related extensions be used in LocalSettings in order to setup wgAuth instead of using wgExtensionFunctions ?
If so, then does it mean that such extension can't rely on MW HTTP facilities ?

You'll want to create a $wgAuth instance I think (or should even that not run until wgExtensionFunctions time? quite possibly) but you definitely should NOT be actively attempting to use framework features as nothing may be set up yet.

raphael.droz wrote:

I need MWHttpRequest during Auth::authenticate.
Just tested and it happens that wfIniGetBool *is* defined at this time.
(thus I'm fine with WONTFIX)

*but* if I wanted to use it during the *constructor* of my Auth plugin it would have failed.