X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=api.php;h=db9de75156e9502a8548fdf9a7258ba42b33d8ad;hp=9c5ac957160260207b2c292b45a26dfaee75c127;hb=f415b6e16281f50b2bc8f499773297b3498fa15e;hpb=11a8e0160034e4e0a7398f8b858b4fcff23c7ab7 diff --git a/api.php b/api.php index 9c5ac95716..db9de75156 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() ); @@ -72,7 +72,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 +103,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() ) {