prevents fatal error if mcrypt module is missing
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 15 Mar 2016 08:53:01 +0000 (09:53 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 15 Mar 2016 10:00:35 +0000 (11:00 +0100)
Change-Id: I3f18dd16fc8e769d811fbc69df2923269dbb2f2d
Reviewed-on: http://gerrit.tine20.com/customers/2908
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Auth/CredentialCache.php

index 73c7e4b..8d283b2 100644 (file)
@@ -234,6 +234,10 @@ class Tinebase_Auth_CredentialCache extends Tinebase_Backend_Sql_Abstract implem
      */
     protected function _encrypt($_cache)
     {
+        if (! extension_loaded('mcrypt')) {
+            throw new Tinebase_Exception_SystemGeneric('mcrypt extension required');
+        }
+
         $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', '');
         mcrypt_generic_init($td, $_cache->key, substr($_cache->getId(), 0, 16));
         
@@ -255,6 +259,10 @@ class Tinebase_Auth_CredentialCache extends Tinebase_Backend_Sql_Abstract implem
      */
     protected function _decrypt($_cache)
     {
+        if (! extension_loaded('mcrypt')) {
+            throw new Tinebase_Exception_SystemGeneric('mcrypt extension required');
+        }
+
         $encryptedData = base64_decode($_cache->cache);
         
         $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', '');