I got a bunch of notice and warning messages before I flush all cache in Drupal. These messages disappear after flushing cache.

Notice: Undefined index: bundles in field_info_bundles() (line 576 of /***/modules/field/field.info.inc).
Warning: Invalid argument supplied for foreach() in _field_info_collate_fields() (line 215 of /***/dev/modules/field/field.info.inc).
Notice: Undefined index: view modes in _field_info_prepare_instance() (line 306 of /***/modules/field/field.info.inc).
Warning: array_keys() [function.array-keys]: The first argument should be an array in _field_info_prepare_instance() (line 306 of /***/modules/field/field.info.inc).
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in _field_info_prepare_instance() (line 306 of /***/modules/field/field.info.inc).
Notice: Undefined index: view modes in field_view_mode_settings() (line 661 of /***/modules/field/field.module).
Warning: Invalid argument supplied for foreach() in _field_info_prepare_instance() (line 308 of /***/modules/field/field.info.inc).
Notice: Undefined index: schema_fields_sql in DrupalDefaultEntityController->buildQuery() (line 265 of /***/includes/entity.inc).
Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in /***/includes/entity.inc on line 284 and defined in SelectQuery->fields() (line 1320 of /***/includes/database/select.inc).

Some of these messages are similar to issue #1210178: Undefined Index bundles in field_info_bundles()

Drupal 7.8

Comments

Balbo’s picture

Similar here:

Warning: Invalid argument supplied for foreach() in field_view_mode_settings() (linea 661 di /.../htdocs/modules/field/field.module).
Warning: Invalid argument supplied for foreach() in field_view_mode_settings() (linea 661 di /.../htdocs/modules/field/field.module).
Warning: Invalid argument supplied for foreach() in field_view_mode_settings() (linea 661 di /.../htdocs/modules/field/field.module).

(3 times the same warning)

aangel’s picture

I was getting the same error trying to get Entity 1.0 and Profile2 beta 10 to work together. Uprading to the dev version of Oct 7 made the error go away for me.

Refineo’s picture

Thanks, I will test Entity dev of Oct 7 and Profile2 1.0 now.

alalamo’s picture

I am not using either the Entity 1.0 API module or Profile2 module, and started getting this error this morning:

Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in C:\inetpub\wwwroot\includes\entity.inc on line 284 and defined in SelectQuery->fields() (line 1320 of C:\inetpub\wwwroot\includes\database\select.inc).

The problem must be in Core Entity system, and not caused by a contributed module. Any ideas as to what is going on?

wjaspers’s picture

@TainoTechy, there's a patch out there by @rfay, if I can find it. Basically, the core entity system doesn't check if an array is passed to ->fields(). If any EntityFieldQuery or SelectQuery tries to use this without a valid list of fields, it will substitute NULL and crash...

mcjim’s picture

alalamo’s picture

It appears that I stopped getting entity system errors when I updated to 7.9.

Thanks!

wjaspers’s picture

Version: 7.8 » 7.9
Status: Active » Fixed

Marking as fixed, since this appears to be resolved in 7.9 and later.

mgifford’s picture

I'm getting a very similar error in 7.9 - the patch by @mcjim wasn't rolled into core yet.

wjaspers’s picture

Status: Fixed » Active
srlawr’s picture

I was getting this problem a lot in D 7.12 whenever installing new modules or flushing the cache.

It comes after about a dozen error messages reading:

Warning: array_keys() expects parameter 1 to be array, null given in drupal_schema_fields_sql() (line 6842 of \includes\common.inc).

I tried reversing out some contrib modules to eliminate the problem, and saw I could actually remove Rules, as it wasn't in use, but by doing so I have completely broken my site to the message reported in this issue. Even re-enabling Rules via the DB.system table won't bring it back.. problematic.

SMartin’s picture

Title: Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in entity.inc » Newb: Is this still ongoing...?
Version: 7.9 » 7.17

Hi,

(Newb Alert...)

(I seem to have changed the title of this issue. Really sorry... Can't seem to change it back)

Is this issue still unresolved?

When I try to add a new page of content on my D 7.17 site I get two errors:

1) Warning: array_keys() [function.array-keys]: The first argument should be an array in drupal_schema_fields_sql() (line 6969 of /home/****/public_html/****/includes/common.inc).

2) Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in /home/***/public_html/***/includes/entity.inc on line 284 and defined in SelectQuery->fields() (line 1300 of /home/****/public_html/****/includes/database/select.inc).

When I clear caches I get error 1) on the "Performance" page. I still get both errors when I try to add content.

I *was* also getting error 1) on the 'Modules' page but no longer...

I'm not even sure the two errors are related to be honest...

If I disable the entity api module the errors persist even after clearing caches.

Hope someone can help... At the moment I can't add anything to my site.

I'm not able to apply patches due to my hosting environment but I could perhaps make manual changes to files if I knew what needed to be done...

Thanks :-)

S

SMartin’s picture

Title: Newb: Is this still ongoing...? » Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in entity.inc

Hi,

I got myself together and applied the patch mentioned in #6 locally and then uploaded to the server...

My error 2) Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in /home/***/public_html/***/includes/entity.inc on line 284 and defined in SelectQuery->fields() (line 1300 of /home/****/public_html/****/includes/database/select.inc).

is now gone!

I still get 1) Warning: array_keys() [function.array-keys]: The first argument should be an array in drupal_schema_fields_sql() (line 6969 of /home/****/public_html/****/includes/common.inc).

twice on the "Performance" page when I clear caches and once when I try to create new content.

At least the new content page loads now, which it wasn't before...

s