Running Drupal 7.22 (unable to upgrade at this time due to server constraints), with File Entity module enabled, ANONYMOUS user (only, admin works just fine) sees the following warnings on page load:
Warning: Illegal offset type in isset or empty in DrupalCacheArray->offsetGet() (line 352 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in DrupalCacheArray->offsetGet() (line 352 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: Illegal offset type in isset or empty in SchemaCache->resolveCacheMiss() (line 2920 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: Illegal offset type in SchemaCache->resolveCacheMiss() (line 2921 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: Illegal offset type in DrupalCacheArray->persist() (line 390 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: Illegal offset type in isset or empty in DrupalCacheArray->offsetGet() (line 352 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in DrupalCacheArray->offsetGet() (line 352 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: Illegal offset type in isset or empty in SchemaCache->resolveCacheMiss() (line 2920 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: Illegal offset type in SchemaCache->resolveCacheMiss() (line 2921 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Warning: Illegal offset type in DrupalCacheArray->persist() (line 390 of /home/content/23/6273123/html/000_other_domains/kennycarlile.com/www/includes/bootstrap.inc).
Disabling the module removes the warnings. As stated, these warnings only appear for anonymous users. I never see these as administrator. I only need this module to support the Media module, but I get these warnings even with Media disabled and only File Entity enabled.
I'd appreciate any help that can be offered. I've done a little looking around in the code, but I'm not very familiar with this module. Thanks!
Comment | File | Size | Author |
---|---|---|---|
#5 | 2195197.patch | 654 bytes | stefan.r |
|
Comments
Comment #1
ryanc CreditAttribution: ryanc commentedIn my case this problem was linked to a view that has a File field in a relationship. I was running a text search across the node title & file name at the same time. The code that [sometimes] fails only runs for users without the bypass file access permission (usually anonymous users).
_file_entity_query_file_entity_access_alter()
in file_entity.module checks loops through all the tables from the query (it is adding conditions to). It checks if each table, is an instance of SelectQueryInterface, and if it isn't searches for a possible table name. However, it seems that sometimes instead of a table name (string) it gets an instance of SelectQueryInterface. Whendrupal_get_schema($table)
is called, File Entity is not always passing it a string.I don't sufficiently understand what kind of base table the method is looking for, so I can't submit a patch.
The options seem to be:
1. Allowing anonymous users to access all files (bypass file access permission) - probably a bad idea
2. Removing the file from the Views relationship (which worked for me).
VERSIONS
Drupal: 7.24
File entity: 7.x-2.0-alpha1
There are some changes to that functionality in alpha3 and there are bug reports about a similar issue (https://drupal.org/node/2147327). Although that bug report actually relate to the missing content, rather than the PHP warning you are seeing. I don't think the issues with PHP warnings is fixed yet.
Comment #2
KCarlile CreditAttribution: KCarlile commentedAh!! You're right, ryanc! Thank you! I have a view loading some links with associated image icons for social icons in my header. As soon as I disabled that block, the error went away. I still need to figure out how to fix this (and it's still a bug), but at least I know what is causing it now. Thank you so much for your help! :)
Comment #3
KCarlile CreditAttribution: KCarlile commentedAfter some searching, I found the Image URL Formatter module (https://drupal.org/project/image_url_formatter) and I was able to use that to recreate the behavior I wanted to render the full file paths in my view. Again, this is still a bug, but at least there is an apparent workaround for it now, at least in my case. Thanks again for your help, ryanc.
Comment #4
VanD CreditAttribution: VanD commentedThis is still an issue.
Comment #5
stefan.r CreditAttribution: stefan.r commentedGood analysis in #1, this code was introduced in #1959260: Ensure a 'file_access' tag is used on all queries of outputted files => alpha1 breaks EntityFieldQuery not releated to files.
Indeed, in some cases, the contents of the 'table' key are another SelectQuery, which I don't think is what we're looking for :)
Bumping to major as this is quite a nasty looking error, which prevents the page from being cached.
Comment #6
Dave ReidCan someone provide me a Feature or Views export with how to reproduce this?
Comment #7
jamesrward CreditAttribution: jamesrward as a volunteer commented@dave-reid I'm working on getting something together for you but I'm having trouble picking apart which pieces cause the issue. We're seeing this on a few specific pages. Can I give you github clone access to our site codebase and send you a cleaned version of our database for testing?
Comment #8
Rishi KulshreshthaPatch attached in #5 worked for me. Hence marking this as RTBC
Comment #9
Dave ReidI still need the info requested in #6. Ideally just a simple features export, as trying to replicate an entire site on my local is more work than I can provide time for here.
Comment #10
hijera CreditAttribution: hijera commented#9 , made special example for that issue.
You need to create any type of node with private files field beforehand and upload some files.
That view works good when user has administrator role ,and dont work with any others
Comment #11
hijera CreditAttribution: hijera as a volunteer commentedI made a test view to show that error.
It shows all nodes with private files for user that has administrator role and doesn't work for other roles.
Comment #12
bkosborneWe encountered this issue as well, and confirm that the patch resolved the issue for us.
Comment #14
joseph.olstadfixed in 7.x-2.x dev