From 64a83aac36e7564e50640db90b0e146141c516fc Mon Sep 17 00:00:00 2001 From: Markus Glaser Date: Sat, 15 Oct 2011 01:33:19 +0000 Subject: [PATCH] follow-up to r98020. Throw MWException on attempt to serialize database. --- includes/db/Database.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 239b43086f..003c4cb4d6 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -608,15 +608,13 @@ abstract class DatabaseBase implements DatabaseType { } } - /** - * Called by unserialize. Needed to reopen DB connection, which - * is not saved by serialize. + /** + * Called by serialize. Throw an exception when DB connection is serialized. + * This causes problems on some database engines because the connection is + * not restored on unserialize. */ - public function __wakeup() { - if ( $this->isOpen() ) { - $this->open( $this->mServer, $this->mUser, - $this->mPassword, $this->mDBname); - } + public function __sleep() { + throw new MWException( 'Database serialization may cause problems, since the connection is not restored on wakeup.' ); } /** -- 2.20.1