dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Http::getProxy() method to get proxy configuration"
[lhc/web/wiklou.git]
/
includes
/
exception
/
MWException.php
diff --git
a/includes/exception/MWException.php
b/includes/exception/MWException.php
index
478fead
..
e1d7e6c
100644
(file)
--- a/
includes/exception/MWException.php
+++ b/
includes/exception/MWException.php
@@
-70,7
+70,7
@@
class MWException extends Exception {
* @param array $args Arguments to pass to the callback functions
* @return string|null String to output or null if any hook has been called
*/
* @param array $args Arguments to pass to the callback functions
* @return string|null String to output or null if any hook has been called
*/
- public function runHooks( $name, $args =
array()
) {
+ public function runHooks( $name, $args =
[]
) {
global $wgExceptionHooks;
if ( !isset( $wgExceptionHooks ) || !is_array( $wgExceptionHooks ) ) {
global $wgExceptionHooks;
if ( !isset( $wgExceptionHooks ) || !is_array( $wgExceptionHooks ) ) {
@@
-84,7
+84,7
@@
class MWException extends Exception {
}
$hooks = $wgExceptionHooks[$name];
}
$hooks = $wgExceptionHooks[$name];
- $callargs = array_merge(
array( $this )
, $args );
+ $callargs = array_merge(
[ $this ]
, $args );
foreach ( $hooks as $hook ) {
if (
foreach ( $hooks as $hook ) {
if (
@@
-238,8
+238,7
@@
class MWException extends Exception {
} elseif ( self::isCommandLine() ) {
MWExceptionHandler::printError( $this->getText() );
} else {
} elseif ( self::isCommandLine() ) {
MWExceptionHandler::printError( $this->getText() );
} else {
- self::header( 'HTTP/1.1 500 MediaWiki exception' );
- self::header( 'Status: 500 MediaWiki exception' );
+ self::statusHeader( 500 );
self::header( "Content-Type: $wgMimeType; charset=utf-8" );
$this->reportHTML();
self::header( "Content-Type: $wgMimeType; charset=utf-8" );
$this->reportHTML();
@@
-266,4
+265,9
@@
class MWException extends Exception {
header( $header );
}
}
header( $header );
}
}
+ private static function statusHeader( $code ) {
+ if ( !headers_sent() ) {
+ HttpStatus::header( $code );
+ }
+ }
}
}