From: DannyS712 Date: Sat, 10 Aug 2019 23:55:45 +0000 (+0000) Subject: Fix Special:NewSection showNoRedirectPage form handling (3) X-Git-Tag: 1.34.0-rc.0~735 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/Category:Bar1?a=commitdiff_plain;h=67b17417299331efc246decf64ce60ecde8dff27;p=lhc%2Fweb%2Fwiklou.git Fix Special:NewSection showNoRedirectPage form handling (3) Handle invalid titles by using `newFromTextThrow` and returning a fatal status if the title is invalid. Bug: T207577 Change-Id: I2bdfcdbcb7ee41f96122e7f8aa561f6eee34be7b --- diff --git a/includes/specials/SpecialNewSection.php b/includes/specials/SpecialNewSection.php index a24d8cda69..c124c14f1d 100644 --- a/includes/specials/SpecialNewSection.php +++ b/includes/specials/SpecialNewSection.php @@ -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 );