Using sf_cache, whenever the cache was cleared the page was filled with the following error messages.
warning: Illegal offset type in isset or empty in /var/www/some.website/sites/all/modules/sf_cache/sf_cache.api.inc on line 385.
warning: Illegal offset type in /var/www/some.website/sites/all/modules/sf_cache/sf_cache.api.inc on line 388.
warning: Illegal offset type in /var/www/some.website/sites/all/modules/sf_cache/sf_cache.api.inc on line 394.
warning: Illegal offset type in /var/www/some.website/sites/all/modules/sf_cache/sf_cache.api.inc on line 394. (repeated 100 times)
Adding dsm($key) and dsm($file) to the lines above 385 in sf_cache/sf_cache.api.inc revealed the following.
$key
... (Object) stdClass
fid (String, 3 characters ) 244
uid (String, 1 characters ) 1
filename (String, 20 characters ) filefield_ClVsyS.png
filepath (String, 59 characters ) sites/some.website.org/files/node/1073/filefiel...
+
sites/some.website.org/files/node/1073/filefield_ClVsyS.png
filemime (String, 9 characters ) image/png
filesize (String, 3 characters ) 675
status (String, 1 characters ) 1
timestamp (String, 10 characters ) 1271395424
origname (String, 20 characters ) filefield_ClVsyS.png
Called from /var/www/some.website/sites/all/modules/sf_cache/sf_cache.api.inc
$files
... (Array, 0 elements)
Called from /var/www/some.website/sites/all/modules/sf_cache/sf_cache.api.inc
So sf_cache was being passed an object for $key when it was expecting an array. The attached patch addresses this problem, please review.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 812300-6-bundlecache-filefield-conflict.patch | 7.97 KB | neilnz |
| #3 | sf_cache.patch | 6.17 KB | davidwhthomas |
| sf_cache_illegal_offset_fix.patch | 56 bytes | agileware |
Comments
Comment #1
agileware commentedChanging status to need review.
Comment #2
agileware commentedUpdating title
Comment #3
davidwhthomas commentedThe problem here is that there's a namespace collision between the
sf_cache_file_loadfunction name and the hookhook_file_loaddefined by the filefield module infield_file_loadA better solution, than above, would be to rename the function to avoid the namespace collision altogether. This will prevent further errors in the future.
The attached patch renames the function from
sf_cache_file_loadtosf_cache_file_db_loadinstead.DT
Comment #4
wim leersMoving to the Bundlecache issue queue, as per #962178: Rename/migrate to Bundlecache and provide a stable D6 release..
Comment #5
mr.j commentedThe same problem happens on file deletion.
Renaming
sf_cache_file_deletetosf_cache_file_db_deletefixed the problem for me.Comment #6
neilnz commentedHere's a revised patch against Bundlecache incorporating #3 and #5