HTMLForm: Throw exceptions in some circumstances
authorAndrew Garrett <werdna@users.mediawiki.org>
Mon, 3 May 2010 09:10:50 +0000 (09:10 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Mon, 3 May 2010 09:10:50 +0000 (09:10 +0000)
includes/HTMLForm.php

index ba4720e..636e0d0 100644 (file)
@@ -191,6 +191,14 @@ class HTMLForm {
         * @return Bool whether submission was successful.
         */
        function show() {
+               // Check if we have the info we need
+               if ( ! $this->mTitle ) {
+                       throw new MWException( "You must call setTitle() on an HTMLForm" );
+               }
+               if ( ! $this->mSubmitCallback ) {
+                       throw new MWException( "You must set a submission callback" );
+               }
+               
                $html = '';
 
                self::addJS();