The execution of an API request can throw an exception.
In those cases $processor->getModule() could return NULL.
Use the module manager directly to try to retrieve the
module instance.
Change-Id: Ie49762681ef797388216ab40d99b8e7458a837f6
);
$items[] = $wgRequest->wasPosted() ? 'POST' : 'GET';
if ( $processor ) {
- $module = $processor->getModule();
- if ( $module->mustBePosted() ) {
+ try {
+ $manager = $processor->getModuleManager();
+ $module = $manager->getModule( $wgRequest->getVal( 'action' ), 'action' );
+ } catch ( Exception $ex ) {
+ $module = null;
+ }
+ if ( !$module || $module->mustBePosted() ) {
$items[] = "action=" . $wgRequest->getVal( 'action' );
} else {
$items[] = wfArrayToCgi( $wgRequest->getValues() );