diff --git a/lib/SimpleSAML/Memcache.php b/lib/SimpleSAML/Memcache.php index e83835ed439906c7f837a66510c2cdfbc09927c3..11cf3b5873a8471676cc480737018216b9412fb8 100644 --- a/lib/SimpleSAML/Memcache.php +++ b/lib/SimpleSAML/Memcache.php @@ -249,12 +249,13 @@ class SimpleSAML_Memcache { * @return A Memcache object of the servers in the group. */ private static function loadMemcacheServerGroup(array $group) { + + if(!class_exists('Memcache')) { + throw new Exception('Missing Memcache class. Is the memcache extension installed?'); + } + /* Create the Memcache object. */ $memcache = new Memcache(); - if($memcache == NULL) { - throw new Exception('Unable to create an instance of a Memcache object.' . - ' Is the memcache extension installed?'); - } /* Iterate over all the servers in the group and add them to the Memcache object. */ foreach($group as $index => $server) {