mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
Prevent a server crash when using together APC cache and Mcrypt
SVN:trunk[2498]
This commit is contained in:
@@ -1609,6 +1609,22 @@ class AttributeEncryptedString extends AttributeString
|
||||
self::$sKey = MetaModel::GetConfig()->GetEncryptionKey();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* When the attribute definitions are stored in APC cache:
|
||||
* 1) The static class variable $sKey is NOT serialized
|
||||
* 2) The object's constructor is NOT called upon wakeup
|
||||
* 3) mcrypt may crash the server if passed an empty key !!
|
||||
*
|
||||
* So let's restore the key (if needed) when waking up
|
||||
**/
|
||||
public function __wakeup()
|
||||
{
|
||||
if (self::$sKey == null)
|
||||
{
|
||||
self::$sKey = MetaModel::GetConfig()->GetEncryptionKey();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function GetSQLCol() {return "TINYBLOB";}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user