Problem/Motivation

I get loads of these errors when cache_metrics is enabled:

Notice: Object of class stdClass could not be converted to int in Drupal\cache_metrics\CacheBackendWrapper->get() (line 72 of modules/contrib/cache_metrics/src/CacheBackendWrapper.php).

It's caused by these lines:

https://git.drupalcode.org/project/cache_metrics/blob/8.x-1.x/src/CacheB...

Proposed resolution

Rather than cast to integer, check the value of $cache === FALSE to indicated a hit / miss.

Remaining tasks

Fix.

CommentFileSizeAuthor
#3 stdclass_cast_int_fix-3113213-3.patch836 bytesm4olivei

Comments

m4olivei created an issue. See original summary.

m4olivei’s picture

Assigned: Unassigned » m4olivei
m4olivei’s picture

Assigned: m4olivei » Unassigned
Status: Active » Needs review
StatusFileSize
new836 bytes

Here is a patch to fix.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

  • m4olivei committed 38819a8 on 8.x-1.x
    Issue #3113213 by m4olivei, moshe weitzman: Notice: Object of class...
m4olivei’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Committed to 8.x-1.x.

Status: Fixed » Closed (fixed)

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