Browse Source

Catching any possible exception in DatabaseSession destructor, using exceptions in destructors is a bad idea in PHP

Jose Lorenzo Rodriguez 14 years ago
parent
commit
e25867da79
1 changed files with 3 additions and 1 deletions
  1. 3 1
      lib/Cake/Model/Datasource/Session/DatabaseSession.php

+ 3 - 1
lib/Cake/Model/Datasource/Session/DatabaseSession.php

@@ -150,6 +150,8 @@ class DatabaseSession implements CakeSessionHandlerInterface {
  * @return void
  */
 	public function __destruct() {
-		session_write_close();
+		try {
+			session_write_close();
+		} catch (Exception $e) {}
 	}
 }