From: Markus Glaser Date: Sat, 15 Oct 2011 01:33:19 +0000 (+0000) Subject: follow-up to r98020. Throw MWException on attempt to serialize database. X-Git-Tag: 1.31.0-rc.0~27107 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=64a83aac36e7564e50640db90b0e146141c516fc;p=lhc%2Fweb%2Fwiklou.git follow-up to r98020. Throw MWException on attempt to serialize database. --- 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.' ); } /**