I am using version 7.x-1.6 when i am going for enable module from admin it shows me fatal error

Fatal error: Call to a member function getStats() on boolean in D:\XAMPP\htdocs\xxxxxxx\sites\all\modules\contrib\memcache\memcache-lock.inc on line 19

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fawwad.nirvana created an issue. See original summary.

dodozhang21’s picture

We saw this as well. This requires a patch. The reasons is that dmemcache_object('semaphore'); can return a boolean and calling $mc->getStatus() on a boolean gives this FATAL error.

dodozhang21’s picture

Ooops not sure what happened to the first one. Try 2.

SamirMtl’s picture

Hi
Thank you dodozhang21 for this patch, but it seems not applicable for every one
Please, take a look at this patch https://www.drupal.org/files/issues/memcache_api_and_integration-memcach... , and pay attention on the path of the file to patch, in your patch the file to patch is b/sites/all/modules/contrib/memcache/memcache-lock.inc, you may specify the file location like so : b/memcache-lock.inc

agusluc88’s picture

I'm getting the same error on almost every page load.

[Wed Jun 07 19:17:45.329264 2017] [:error] [pid 6079] [client 172.1.2.999:47282] PHP Fatal error:  Call to a member function getStats() on a non-object in /var/www/XXXX.com/sites/all/modules/contrib/memcache/memcache-lock.inc on line 19, referer: https://XXXX.com/admin/config/development/maintenance

Tried the patch of #3 and solved the problem.

Drupal 7.53
PHP 5.5.38
AWS Memcached Client 1.0.1 (x64)

alebnn’s picture

Hi, unfortunately none of the solutions provided is working for me....
Here my updated (and still not working) memcache-lock.inc
<?php

/**
* @file
* A memcache based implementation of a locking mechanism.
* See includes/lock.inc for documenation
*/

require_once dirname(__FILE__) . '/dmemcache.inc';

// Check if memcached is available - if not include default lock handler.
// @todo get rid of this conditional include as soon as this is done:
// http://drupal.org/node/1225404
$lock_file = dirname(__FILE__) . '/memcache-lock-code.inc';
$mc = dmemcache_object('semaphore');
// dmemcache_object always returns TRUE, we don't need these stats but it forces
// us to try and connect to memcache. If this fails, we can't store locks in
// memcache.
if (!$mc || !$mc->getStats()) {
// (!$mc->getStats()) {
$lock_file = DRUPAL_ROOT . '/includes/lock.inc';
}
require_once $lock_file;

any help/support is highly appreciated,
Alejandro.

osopolar’s picture

Patch #3 works for me to. I just fixed the -p1 compatibility of the patch file, as in #4.

guilopes’s picture

Status: Needs review » Reviewed & tested by the community

I think we can go ahead an merge it on. The patch solve the problems

andrex84’s picture

It works for me, thanks a lot

ciss’s picture

I just got a status update mail for this issue, but I don't see any changes. What's going on?

Fabianx’s picture

+1 for RTBC, makes sense

  • dodozhang21 authored 38c8b9b on 7.x-1.x
    Issue #2879600 by dodozhang21, osopolar: Call to a member function...
Jeremy’s picture

Priority: Critical » Major
Status: Reviewed & tested by the community » Fixed

Thanks! Fix committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

btully’s picture

Thanks for this patch @dodozhang21 and @osopolar :)

mattwmc’s picture

Got the error when upgrading to php 7.1 and patches do not work.

Any ideas? Thanks.

sokru’s picture

@mattwmc got same issue when upgrading to php 7.1. Using dev version (#fbdbd70) fixed the issue.