X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fexception%2FBadTitleError.php;h=40c18a42029480a39576eae70a40b356cf9f1ce0;hb=e73328601d51674e8fef89c3db12b30ceafd702f;hp=039b9c60cced3d4c83e7cf1211a43f0d3759f64e;hpb=6989663bbc53c59e0f931a9f112798ea9cccd5e4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/exception/BadTitleError.php b/includes/exception/BadTitleError.php index 039b9c60cc..40c18a4202 100644 --- a/includes/exception/BadTitleError.php +++ b/includes/exception/BadTitleError.php @@ -20,23 +20,24 @@ /** * Show an error page on a badtitle. - * Similar to ErrorPage, but emit a 400 HTTP error code to let mobile - * browser it is not really a valid content. + * + * Uses BadRequestError to emit a 400 HTTP error code to ensure caching proxies and + * mobile browsers know not to cache it as valid content. (T35646) * * @since 1.19 * @ingroup Exception */ -class BadTitleError extends ErrorPageError { +class BadTitleError extends BadRequestError { /** * @param string|Message|MalformedTitleException $msg A message key (default: 'badtitletext'), or * a MalformedTitleException to figure out things from * @param array $params Parameter to wfMessage() */ - public function __construct( $msg = 'badtitletext', $params = array() ) { + public function __construct( $msg = 'badtitletext', $params = [] ) { if ( $msg instanceof MalformedTitleException ) { $errorMessage = $msg->getErrorMessage(); if ( !$errorMessage ) { - parent::__construct( 'badtitle', 'badtitletext', array() ); + parent::__construct( 'badtitle', 'badtitletext', [] ); } else { $errorMessageParams = $msg->getErrorMessageParameters(); parent::__construct( 'badtitle', $errorMessage, $errorMessageParams ); @@ -45,17 +46,4 @@ class BadTitleError extends ErrorPageError { parent::__construct( 'badtitle', $msg, $params ); } } - - /** - * Just like ErrorPageError::report() but additionally set - * a 400 HTTP status code (bug 33646). - */ - public function report() { - global $wgOut; - - // bug 33646: a badtitle error page need to return an error code - // to let mobile browser now that it is not a normal page. - $wgOut->setStatusCode( 400 ); - parent::report(); - } }