When using PHP 7.1 I'm getting the following warning:
Warning: A non-numeric value encountered in MemCacheDrupal->reloadVariables() (line 619 of /mnt/www/html/gsbpublicdev/docroot/profiles/gsb_public/modules/contrib/memcache/memcache.inc).

This warning seemed to cause the side effect of displaying watchdog messages to all users, include anonymous users.

This seemed to go against the setting (set to 'none') we had in place on this page:
/admin/config/development/logging

We were using version 7.x-1.6 of the memcache module.

Comments

gmercer created an issue. See original summary.

gmercer’s picture

StatusFileSize
new641 bytes

I've created the following patch file to resolve this issue.

gmercer’s picture

StatusFileSize
new1.17 KB

I've run across one more line that was giving us a lot of watchdog warnings on our system, once we switch to PHP 7.1

webchick’s picture

Status: Active » Needs review

There's a patch, so marking needs review.

gmercer’s picture

StatusFileSize
new1.74 KB

Found another place that putting out a lot of watchdog warnings on our system, once we switch to PHP 7.1

solution33r’s picture

We figured out the solution, with 100% certainty.

This issue you were experiencing was related to changes in PHP 7.1, but it was not a problem with the memcache module.

drupal-watchdog notice Oct 11 14:15:51: https://www.[redacted]|1539267351|php|[redacted]|https://www.[redacted]/cron.php?cron_key=QqOcJ7*||0||Warning: A non-numeric value encountered in MemCacheDrupal->garbageCollection() (line 101 of /mnt/www/html/[redacted]/docroot/profiles/[redacted]/modules/contrib/memcache/memcache.inc). request_id="v-0ad9e5be-*"

We noted line 101 in the error - which was from MemCacheDrupal::garbageCollection():

$expire = REQUEST_TIME - variable_get('cache_lifetime_' . $this->bin, variable_get('cache_lifetime', 0));

We suspected, based on this evidence, that one or both of the variable_get()'s could be returning a bad value. We were right - cache_lifetime returns the string s:1:"0":

$ drush ev 'var_dump(variable_get("cache_lifetime")); echo PHP_EOL;'

string(7) "s:1:"0""

...and the source of that was a $conf set in settings.php:

sites/default/settings.php
208:$conf['cache_lifetime'] = 's:1:"0"';

Comparing this to a "healthy" site (another customer running the same versions of PHP, Drupal, and the memcache module), we found:

[redacted]@web-xxxx:/var/www/html/[redacted].prod/docroot$ drush ev 'var_dump(variable_get("cache_lifetime")); echo PHP_EOL;'

string(1) "0"

To verify, we used https://3v4l.org/ to see if and when this (passing s:1:"0") would break (issue a Warning), and discovered a difference introduced in PHP7.1 but not 5.6 - that's why it wasn't appearing before. It's also important to note that this is not causing more damage other than filling up the logs - it's still passing the value, and issuing a new Warning. Note the arithmetic operation still works:

View screengrab on Imgur

We can close this issue.

solution33r’s picture

Status: Needs review » Closed (works as designed)

See comment #6 - issue has been resolved by Acquia Support.