Fix Special:NewSection showNoRedirectPage form handling (3)
[lhc/web/wiklou.git] / includes / specials / SpecialNewSection.php
index a24d8cd..c124c14 100644 (file)
@@ -62,7 +62,11 @@ class SpecialNewSection extends RedirectSpecialPage {
 
        public function onFormSubmit( $formData ) {
                $title = $formData['page'];
-               $page = Title::newFromText( $title );
+               try {
+                       $page = Title::newFromTextThrow( $title );
+               } catch ( MalformedTitleException $e ) {
+                       return Status::newFatal( $e->getMessageObject() );
+               }
                $query = [ 'action' => 'edit', 'section' => 'new' ];
                $url = $page->getFullUrlForRedirect( $query );
                $this->getOutput()->redirect( $url );