Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I found the issue when using entitycache module with filecache. Filecache expects cid to be a string but entitycache is passing it as a integer. This is causing entitycache module to not able to persist cache. Since cid has not been defined as a string in Drupal core so I am not expecting any caching module to pass it necessarily as a string. I would suggest the below patch to fix this issue for the time being.
Index: filecache.inc
===================================================================
--- filecache.inc (revision 1)
+++ filecache.inc (revision 2)
@@ -218,7 +218,7 @@
* The cache or FALSE on failure.
*/
function get($cid) {
- if (!$this->ok || !is_string($cid)) {
+ if ( ( ! $this->ok ) || ( ! ( is_string($cid) || is_integer($cid) || is_float($cid) ) ) ) {
return FALSE;
}
@@ -322,7 +322,7 @@
* the given time, after which it behaves like CACHE_TEMPORARY.
*/
function set($cid, $data, $expire = CACHE_PERMANENT) {
- if (!is_string($cid)) {
+ if ( ! ( is_string($cid) || is_integer($cid) || is_float($cid) ) ) {
return;
}
Comments
Comment #2
shubhraprakash CreditAttribution: shubhraprakash commentedComment #3
shubhraprakash CreditAttribution: shubhraprakash commentedComment #4
shubhraprakash CreditAttribution: shubhraprakash commentedUpdated the patch in the issue.
Comment #5
shubhraprakash CreditAttribution: shubhraprakash commentedComment #6
apadernoComment #7
delacosta456 CreditAttribution: delacosta456 commentedhi @shubhraprakash
i was not seeing bins in some folders , like sites_default_cache_entity_node and after using your code things looks to be ok now (for some bin folder too).
however there is still nothing in folder sites_default_cache_block. could it be because of block cache not set at performance settings ?
Also after using your code, i can see that cache bins are represented by their cid... if it make sense i would like to suggest better naming. for example in folder sites_default_cache_menu cache id looks like this
links@user-menu@page@taxonomy=term=28@fr@1@1
By the way many many many thanks for your code
Thanks
Comment #8
delacosta456 CreditAttribution: delacosta456 commentedhi
this is definitely a bug that i also have with non-dev version of this module.
Can somebody help please with a correct patch ?
Thanks