Do a last check before creating the object to not throw a fatal error when calling...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 25 Oct 2008 16:23:09 +0000 (16:23 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 25 Oct 2008 16:23:09 +0000 (16:23 +0000)
includes/api/ApiMain.php

index 1fc65f3..35c1426 100644 (file)
@@ -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);
        }