X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=api.php;h=0fb674b9ebe9706c746de36067fedc849f465cf5;hb=574bd38c04cda411b6382046e0553d85fffc9aa9;hp=9c5ac957160260207b2c292b45a26dfaee75c127;hpb=1ec702e4fdda8948509f674c118c7bb0d2a232fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/api.php b/api.php index 9c5ac95716..0fb674b9eb 100644 --- a/api.php +++ b/api.php @@ -41,7 +41,7 @@ if ( !$wgRequest->checkUrlExtension() ) { return; } -// Pathinfo can be used for stupid things. We don't support it for api.php at +// PATH_INFO can be used for stupid things. We don't support it for api.php at // all, so error out if it's present. if ( isset( $_SERVER['PATH_INFO'] ) && $_SERVER['PATH_INFO'] != '' ) { $correctUrl = wfAppendQuery( wfScript( 'api' ), $wgRequest->getQueryValues() ); @@ -61,10 +61,9 @@ $wgTitle = Title::makeTitle( NS_SPECIAL, 'Badtitle/dummy title for API calls set RequestContext::getMain()->setTitle( $wgTitle ); try { - /* Construct an ApiMain with the arguments passed via the URL. What we get back - * is some form of an ApiMain, possibly even one that produces an error message, - * but we don't care here, as that is handled by the constructor. - */ + // Construct an ApiMain with the arguments passed via the URL. What we get back + // is some form of an ApiMain, possibly even one that produces an error message, + // but we don't care here, as that is handled by the constructor. $processor = new ApiMain( RequestContext::getMain(), true ); // Last chance hook before executing the API @@ -72,7 +71,11 @@ try { if ( !$processor instanceof ApiMain ) { throw new MWException( 'ApiBeforeMain hook set $processor to a non-ApiMain class' ); } -} catch ( Exception $e ) { +} catch ( Exception $e ) { // @todo Remove this block when HHVM is no longer supported + // Crap. Try to report the exception in API format to be friendly to clients. + ApiMain::handleApiBeforeMainException( $e ); + $processor = false; +} catch ( Throwable $e ) { // Crap. Try to report the exception in API format to be friendly to clients. ApiMain::handleApiBeforeMainException( $e ); $processor = false; @@ -99,7 +102,9 @@ if ( $wgAPIRequestLog ) { try { $manager = $processor->getModuleManager(); $module = $manager->getModule( $wgRequest->getVal( 'action' ), 'action' ); - } catch ( Exception $ex ) { + } catch ( Exception $ex ) { // @todo Remove this block when HHVM is no longer supported + $module = null; + } catch ( Throwable $ex ) { $module = null; } if ( !$module || $module->mustBePosted() ) {