Commit f01bb094 authored by alexpott's avatar alexpott

Issue #2199795 by andypost, twistor, martin107, larowlan, andyceo: Make the...

Issue #2199795 by andypost, twistor, martin107, larowlan, andyceo: Make the Settings class prevent serialization of actual settings
parent 2a7aaa09
......@@ -53,6 +53,19 @@ public static function getInstance() {
return self::$instance;
}
/**
* Protects creating with clone.
*/
private function __clone() {
}
/**
* Prevents settings from being serialized.
*/
public function __sleep() {
throw new \BadMethodCallException('Settings cannot be serialized.');
}
/**
* Returns a setting.
*
......
......@@ -107,4 +107,15 @@ public function providerTestGetHashSaltEmpty() {
);
}
/**
* Ensures settings cannot be serialized.
*
* @covers ::__sleep
*
* @expectedException \BadMethodCallException
*/
public function testSerialize() {
serialize(new Settings([]));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment