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!

CommentFileSizeAuthor
#5 2195197.patch654 bytesstefan.r
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ryanc’s picture

In 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. When drupal_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.

KCarlile’s picture

Ah!! 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! :)

KCarlile’s picture

After 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.

VanD’s picture

Version: 7.x-2.0-alpha3 » 7.x-2.0-beta2

This is still an issue.

stefan.r’s picture

Priority: Normal » Major
Status: Active » Needs review
FileSize
654 bytes

Good 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 :)

array (
  'node' => 
  array (
    'join type' => NULL,
    'table' => 'node',
    'alias' => 'node',
    'condition' => NULL,
    'arguments' => 
    array (
    ),
  ),
  'field_data_field_document' => 
  array (
    'join type' => 'LEFT',
    'table' => 'field_data_field_document',
    'alias' => 'field_data_field_document',
    'condition' => 'node.nid = field_data_field_document.entity_id AND (field_data_field_document.entity_type = :views_join_condition_8 AND field_data_field_document.deleted = :views_join_condition_9)',
    'arguments' => 
    array (
      ':views_join_condition_8' => 'node',
      ':views_join_condition_9' => 0,
    ),
  ),
  'node_field_data_field_document' => 
  array (
    'join type' => 'INNER',
    'table' => 'node',
    'alias' => 'node_field_data_field_document',
    'condition' => 'field_data_field_document.field_document_target_id = node_field_data_field_document.nid',
    'arguments' => 
    array (
    ),
  ),
  'taxonomy_term_data_node' => 
  array (
    'join type' => 'LEFT',
    'table' => 
    SelectQuery::__set_state(array(
      // skipping object contents...
    )),
    'alias' => 'taxonomy_term_data_node',
    'condition' => 'node_field_data_field_document.nid = taxonomy_term_data_node.nid',
    'arguments' => 
    array (
    ),
  ),
  'node_field_data_field_document__field_data_field_download_file' => 
  array (
    'join type' => 'LEFT',
    'table' => 'field_data_field_download_file',
    'alias' => 'node_field_data_field_document__field_data_field_download_file',
    'condition' => 'node_field_data_field_document.nid = node_field_data_field_document__field_data_field_download_file.entity_id AND (node_field_data_field_document__field_data_field_download_file.entity_type = :views_join_condition_10 AND node_field_data_field_document__field_data_field_download_file.deleted = :views_join_condition_11)',
    'arguments' => 
    array (
      ':views_join_condition_10' => 'node',
      ':views_join_condition_11' => 0,
    ),
  ),
  'file_managed_field_data_field_download_file' => 
  array (
    'join type' => 'LEFT',
    'table' => 'file_managed',
    'alias' => 'file_managed_field_data_field_download_file',
    'condition' => 'node_field_data_field_document__field_data_field_download_file.field_download_file_fid = file_managed_field_data_field_download_file.fid',
    'arguments' => 
    array (
    ),
  ),
  'taxonomy_term_data_node__taxonomy_vocabulary' => 
  array (
    'join type' => 'LEFT',
    'table' => 'taxonomy_vocabulary',
    'alias' => 'taxonomy_term_data_node__taxonomy_vocabulary',
    'condition' => 'taxonomy_term_data_node.vid = taxonomy_term_data_node__taxonomy_vocabulary.vid',
    'arguments' => 
    array (
    ),
  ),
);

Bumping to major as this is quite a nasty looking error, which prevents the page from being cached.

Dave Reid’s picture

Can someone provide me a Feature or Views export with how to reproduce this?

jamesrward’s picture

@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?

Rishi Kulshreshtha’s picture

Status: Needs review » Reviewed & tested by the community

Patch attached in #5 worked for me. Hence marking this as RTBC

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs review

I 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.

hijera’s picture

#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

$view = new view();
$view->name = 'fe_test_entity';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'fe_test_entity';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'fe_test_entity';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
/* Relationship: File Usage: File */
$handler->display->display_options['relationships']['node_to_file']['id'] = 'node_to_file';
$handler->display->display_options['relationships']['node_to_file']['table'] = 'file_usage';
$handler->display->display_options['relationships']['node_to_file']['field'] = 'node_to_file';
$handler->display->display_options['relationships']['node_to_file']['label'] = 'File Entity';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Field: File: File ID */
$handler->display->display_options['fields']['fid']['id'] = 'fid';
$handler->display->display_options['fields']['fid']['table'] = 'file_managed';
$handler->display->display_options['fields']['fid']['field'] = 'fid';
$handler->display->display_options['fields']['fid']['relationship'] = 'node_to_file';
/* Field: File: Path */
$handler->display->display_options['fields']['uri']['id'] = 'uri';
$handler->display->display_options['fields']['uri']['table'] = 'file_managed';
$handler->display->display_options['fields']['uri']['field'] = 'uri';
$handler->display->display_options['fields']['uri']['relationship'] = 'node_to_file';
$handler->display->display_options['fields']['uri']['label'] = 'file_path';
/* Field: File: Status */
$handler->display->display_options['fields']['status']['id'] = 'status';
$handler->display->display_options['fields']['status']['table'] = 'file_managed';
$handler->display->display_options['fields']['status']['field'] = 'status';
$handler->display->display_options['fields']['status']['relationship'] = 'node_to_file';
$handler->display->display_options['fields']['status']['label'] = 'file_status';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: File: File ID */
$handler->display->display_options['filters']['fid']['id'] = 'fid';
$handler->display->display_options['filters']['fid']['table'] = 'file_managed';
$handler->display->display_options['filters']['fid']['field'] = 'fid';
$handler->display->display_options['filters']['fid']['relationship'] = 'node_to_file';
$handler->display->display_options['filters']['fid']['operator'] = 'not empty';
/* Filter criterion: File: Path */
$handler->display->display_options['filters']['uri']['id'] = 'uri';
$handler->display->display_options['filters']['uri']['table'] = 'file_managed';
$handler->display->display_options['filters']['uri']['field'] = 'uri';
$handler->display->display_options['filters']['uri']['relationship'] = 'node_to_file';
$handler->display->display_options['filters']['uri']['operator'] = 'contains';
$handler->display->display_options['filters']['uri']['value'] = 'private';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'fe_test_entity';
$translatables['fe_test_entity'] = array(
  t('Master'),
  t('fe_test_entity'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('« first'),
  t('‹ previous'),
  t('next ›'),
  t('last »'),
  t('File Entity'),
  t('File ID'),
  t('file_path'),
  t('file_status'),
  t('Page'),
);
hijera’s picture

I 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.

$view = new view();
$view->name = 'fe_test_entity';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'fe_test_entity';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'fe_test_entity';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
/* Relationship: File Usage: File */
$handler->display->display_options['relationships']['node_to_file']['id'] = 'node_to_file';
$handler->display->display_options['relationships']['node_to_file']['table'] = 'file_usage';
$handler->display->display_options['relationships']['node_to_file']['field'] = 'node_to_file';
$handler->display->display_options['relationships']['node_to_file']['label'] = 'File Entity';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Field: File: File ID */
$handler->display->display_options['fields']['fid']['id'] = 'fid';
$handler->display->display_options['fields']['fid']['table'] = 'file_managed';
$handler->display->display_options['fields']['fid']['field'] = 'fid';
$handler->display->display_options['fields']['fid']['relationship'] = 'node_to_file';
/* Field: File: Path */
$handler->display->display_options['fields']['uri']['id'] = 'uri';
$handler->display->display_options['fields']['uri']['table'] = 'file_managed';
$handler->display->display_options['fields']['uri']['field'] = 'uri';
$handler->display->display_options['fields']['uri']['relationship'] = 'node_to_file';
$handler->display->display_options['fields']['uri']['label'] = 'file_path';
/* Field: File: Status */
$handler->display->display_options['fields']['status']['id'] = 'status';
$handler->display->display_options['fields']['status']['table'] = 'file_managed';
$handler->display->display_options['fields']['status']['field'] = 'status';
$handler->display->display_options['fields']['status']['relationship'] = 'node_to_file';
$handler->display->display_options['fields']['status']['label'] = 'file_status';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: File: File ID */
$handler->display->display_options['filters']['fid']['id'] = 'fid';
$handler->display->display_options['filters']['fid']['table'] = 'file_managed';
$handler->display->display_options['filters']['fid']['field'] = 'fid';
$handler->display->display_options['filters']['fid']['relationship'] = 'node_to_file';
$handler->display->display_options['filters']['fid']['operator'] = 'not empty';
/* Filter criterion: File: Path */
$handler->display->display_options['filters']['uri']['id'] = 'uri';
$handler->display->display_options['filters']['uri']['table'] = 'file_managed';
$handler->display->display_options['filters']['uri']['field'] = 'uri';
$handler->display->display_options['filters']['uri']['relationship'] = 'node_to_file';
$handler->display->display_options['filters']['uri']['operator'] = 'contains';
$handler->display->display_options['filters']['uri']['value'] = 'private';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'fe_test_entity';
$translatables['fe_test_entity'] = array(
  t('Master'),
  t('fe_test_entity'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('« first'),
  t('‹ previous'),
  t('next ›'),
  t('last »'),
  t('File Entity'),
  t('File ID'),
  t('file_path'),
  t('file_status'),
  t('Page'),
);

bkosborne’s picture

We encountered this issue as well, and confirm that the patch resolved the issue for us.

  • stefan.r authored 523093f on 7.x-2.x
    Issue #2195197 by stefan.r: Multiple warnings: Illegal offset type in...
joseph.olstad’s picture

Version: 7.x-2.0-beta2 » 7.x-2.x-dev
Status: Needs review » Fixed

fixed in 7.x-2.x dev

Status: Fixed » Closed (fixed)

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