From: Alexandre Emsenhuber Date: Sat, 25 Oct 2008 16:23:09 +0000 (+0000) Subject: Do a last check before creating the object to not throw a fatal error when calling... X-Git-Tag: 1.31.0-rc.0~44601 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=925846c7d5bc7523cfd765ee57a9843cae1d3430;p=lhc%2Fweb%2Fwiklou.git Do a last check before creating the object to not throw a fatal error when calling api.php?format= --- diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 1fc65f3154..35c14262c4 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -228,6 +228,8 @@ class ApiMain extends ApiBase { * Create an instance of an output formatter by its name */ public function createPrinterByName($format) { + if( !isset( $this->mFormats[$format] ) ) + $this->dieUsage( "Unrecognized format: {$format}", 'unknown_format' ); return new $this->mFormats[$format] ($this, $format); }