From: Aaron Schulz Date: Tue, 29 Jul 2014 00:53:34 +0000 (-0700) Subject: Log errors when several callbacks give exceptions in onTransaction* methods X-Git-Tag: 1.31.0-rc.0~14668^2 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=5e0ac5814dcc46fe7e4a1d8a8f37da86aa788f90;p=lhc%2Fweb%2Fwiklou.git Log errors when several callbacks give exceptions in onTransaction* methods Change-Id: I055f46d98c255749dd64b30bfa2db190ddc73d6b --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 86c2616a52..85f042007f 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -3288,7 +3288,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { protected function runOnTransactionIdleCallbacks() { $autoTrx = $this->getFlag( DBO_TRX ); // automatic begin() enabled? - $e = null; // last exception + $e = $ePrior = null; // last exception do { // callbacks may add callbacks :) $callbacks = $this->mTrxIdleCallbacks; $this->mTrxIdleCallbacks = array(); // recursion guard @@ -3299,6 +3299,10 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { call_user_func( $phpCallback ); $this->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore automatic begin() } catch ( Exception $e ) { + if ( $ePrior ) { + MWExceptionHandler::logException( $ePrior ); + } + $ePrior = $e; } } } while ( count( $this->mTrxIdleCallbacks ) ); @@ -3314,7 +3318,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { * @since 1.22 */ protected function runOnTransactionPreCommitCallbacks() { - $e = null; // last exception + $e = $ePrior = null; // last exception do { // callbacks may add callbacks :) $callbacks = $this->mTrxPreCommitCallbacks; $this->mTrxPreCommitCallbacks = array(); // recursion guard @@ -3323,6 +3327,10 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { list( $phpCallback ) = $callback; call_user_func( $phpCallback ); } catch ( Exception $e ) { + if ( $ePrior ) { + MWExceptionHandler::logException( $ePrior ); + } + $ePrior = $e; } } } while ( count( $this->mTrxPreCommitCallbacks ) );