jenkins-bot has submitted this change and it was merged.
Change subject: Make sure we always restore the error handler.
......................................................................
Make sure we always restore the error handler.
Change-Id: I27f5d11ea27f783eda71c2bfdba7e70695f5d53c
---
M includes/Hooks.php
M includes/UserMailer.php
M includes/db/DatabaseMysqlBase.php
M includes/db/DatabasePostgres.php
M includes/installer/WebInstaller.php
5 files changed, 29 insertions(+), 8 deletions(-)
Approvals:
Parent5446: Looks good to me, approved
Addshore: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 396e360..db47d31 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -199,6 +199,9 @@
$retval = call_user_func_array( $callback,
$hook_args );
} catch ( MWHookException $e ) {
$badhookmsg = $e->getMessage();
+ } catch ( Exception $e ) {
+ restore_error_handler();
+ throw $e;
}
restore_error_handler();
wfProfileOut( $func );
diff --git a/includes/UserMailer.php b/includes/UserMailer.php
index 8ab10b2..6157f78 100644
--- a/includes/UserMailer.php
+++ b/includes/UserMailer.php
@@ -352,14 +352,19 @@
ini_set( 'html_errors', '0' );
set_error_handler( 'UserMailer::errorHandler' );
- $safeMode = wfIniGetBool( 'safe_mode' );
+ try {
+ $safeMode = wfIniGetBool( 'safe_mode' );
- foreach ( $to as $recip ) {
- if ( $safeMode ) {
- $sent = mail( $recip,
self::quotedPrintable( $subject ), $body, $headers );
- } else {
- $sent = mail( $recip,
self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
+ foreach ( $to as $recip ) {
+ if ( $safeMode ) {
+ $sent = mail( $recip,
self::quotedPrintable( $subject ), $body, $headers );
+ } else {
+ $sent = mail( $recip,
self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
+ }
}
+ } catch ( Exception $e ) {
+ restore_error_handler();
+ throw $e;
}
restore_error_handler();
diff --git a/includes/db/DatabaseMysqlBase.php
b/includes/db/DatabaseMysqlBase.php
index 26c9d24..cdfa769 100644
--- a/includes/db/DatabaseMysqlBase.php
+++ b/includes/db/DatabaseMysqlBase.php
@@ -76,6 +76,7 @@
} catch ( Exception $ex ) {
wfProfileOut( "dbconnect-$server" );
wfProfileOut( __METHOD__ );
+ $this->restoreErrorHandler();
throw $ex;
}
$error = $this->restoreErrorHandler();
diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index e564a16..72371a2 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -370,7 +370,14 @@
$this->connectString = $this->makeConnectionString(
$connectVars, PGSQL_CONNECT_FORCE_NEW );
$this->close();
$this->installErrorHandler();
- $this->mConn = pg_connect( $this->connectString );
+
+ try {
+ $this->mConn = pg_connect( $this->connectString );
+ } catch ( Exception $ex ) {
+ $this->restoreErrorHandler();
+ throw $ex;
+ }
+
$phpError = $this->restoreErrorHandler();
if ( !$this->mConn ) {
diff --git a/includes/installer/WebInstaller.php
b/includes/installer/WebInstaller.php
index 53cb7dc..b37e6b3 100644
--- a/includes/installer/WebInstaller.php
+++ b/includes/installer/WebInstaller.php
@@ -336,7 +336,12 @@
$this->phpErrors = array();
set_error_handler( array( $this, 'errorHandler' ) );
- session_start();
+ try {
+ session_start();
+ } catch ( Exception $e ) {
+ restore_error_handler();
+ throw $e;
+ }
restore_error_handler();
if ( $this->phpErrors ) {
--
To view, visit https://gerrit.wikimedia.org/r/95612
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I27f5d11ea27f783eda71c2bfdba7e70695f5d53c
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Platonides <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits