Hey

I tried update a site to 7.42 buy got the following error:
Recoverable fatal error:
Argument 2 passed to SelectQuery::fields() must be of the type array, null given, called in includes/entity.inc on line 317 and defined in

the following patch works as a work-around but i would love to know what am can cause it...

any suggestions? (i don't have any valuable data in php logs or watchdog....)

CommentFileSizeAuthor
fix_null_entity_fields.patch443 bytesarielberg

Comments

arielberg created an issue. See original summary.

arielberg’s picture

Issue summary: View changes
chrisrockwell’s picture

Can you add a backtrace to your patch to see where it's coming from? Best guess is that it's coming from a contrib/custom module.

Mikael Nord’s picture

Same problem here on Drupal 7.50. The workaround patch works fine for me, but this core module bug needs attention.

chrisrockwell’s picture

Status: Active » Closed (duplicate)
senpAi95’s picture

drupal 7.23:
Hello guys,
This is my first time writing the issue. I received this error when i tried to open the page.

Catchable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in /path/drupal/htdocs/includes/entity.inc on line 317 and defined in /path/drupal/htdocs/includes/database/select.inc on line 1316

1)I thought it has something to do with modules and used a backup of htdocs and replaced /sites and .htaccess ..got same error...
2)I even tried downloading drupal7.56(current version 7.23(thought of fixing and updating the drupal core)) and replacing /sites , .htaccess and robots.txt. Got same error.

i ran update.php and it showed following warning

User warning: The following module is missing from the file system: activity. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1143 of /home/cpath/D-path/drupal/htdocs/includes/bootstrap.inc).
User warning: The following module is missing from the file system: activityhistory. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1143 of /home/cpath/D-path/drupal/htdocs/includes/bootstrap.inc).
User warning: The following module is missing from the file system: addressfield. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1143 of /home/cpath/D-path/drupal/htdocs/includes/bootstrap.inc).
.
.
.
.
203 warnings

By this i came to know that a module was missing. What can i do to solve it?
Thanks in advance.

Pascal-’s picture

Updating from 7.63 to 7.67 an ran into this.
Patch fixed it.

rcodina’s picture

ajayyadav’s picture

Version: 7.42 » 10.0.x-dev

Thanks, Fixed error.

bburg’s picture

I ran into this while migrating a site to an updated server. This is not live yet, and we are still working on the environment, but I did get a backtrace output, so in case that is helpful. The best I can gather is that the LDAP php extension is still missing, generated some warnings, and that lead to

Here is my backtrace:

#0  DrupalDefaultEntityController->buildQuery(Array (), Array ([plugin] => reaction rule,[active] => 1), ) called at [/sites/all/modules/contrib/entity/includes/entity.controller.inc:170]
#1  EntityAPIController->buildQuery(Array (), Array ([plugin] => reaction rule,[active] => 1), ) called at [/sites/all/modules/contrib/entity/includes/entity.controller.inc:713]
#2  EntityAPIControllerExportable->buildQuery(, Array ([plugin] => reaction rule,[active] => 1), ) called at [/sites/all/modules/contrib/rules/includes/rules.core.inc:237]
#3  RulesEntityController->buildQuery(, Array ([plugin] => reaction rule,[active] => 1), ) called at [/sites/all/modules/contrib/entity/includes/entity.controller.inc:186]
#4  EntityAPIController->query(, Array ([plugin] => reaction rule,[active] => 1), ) called at [/sites/all/modules/contrib/entity/includes/entity.controller.inc:249]
#5  EntityAPIController->load(, Array ([plugin] => reaction rule,[active] => 1)) called at [/sites/all/modules/contrib/entity/includes/entity.controller.inc:730]
#6  EntityAPIControllerExportable->load(, Array ([plugin] => reaction rule,[active] => 1)) called at [/includes/common.inc:8099]
#7  entity_load(rules_config, , Array ([plugin] => reaction rule,[active] => 1)) called at [/sites/all/modules/contrib/entity/entity.module:259]
#8  entity_load_multiple_by_name(rules_config, , Array ([plugin] => reaction rule,[active] => 1)) called at [/sites/all/modules/contrib/rules/rules.module:892]
#9  rules_config_load_multiple(, Array ([plugin] => reaction rule,[active] => 1)) called at [/sites/all/modules/contrib/rules/includes/rules.plugins.inc:835]
#10 RulesEventSet::rebuildEventCache() called at [/sites/all/modules/contrib/rules/rules.module:413]
#11 rules_get_cache(rules_event_whitelist) called at [/sites/all/modules/contrib/rules/rules.module:1054]
#12 rules_invoke_event(watchdog, Array ([type] => php,[message] => %type: !message in %function (line %line of %file).,[variables] => Array ([%type] => Warning,[!message] => Use of undefined constant LDAP_DEREF_SEARCHING - assumed 'LDAP_DEREF_SEARCHING' (this will throw an Error in a future version of PHP),[%function] => LdapQuery::fields(),[%file] => /sites/all/modules/contrib/ldap/ldap_query/LdapQuery.class.php,[%line] => 440,[severity_level] => 4),[severity] => 4,[link] => ,[user] => stdClass Object ([uid] => 0,[hostname] => 10.250.31.180,[roles] => Array ([1] => anonymous user),[cache] => 0),[uid] => 0,[request_uri] => https://dev.mysite.dev/user/reset/1/1608232243/XXX/login,[referer] => ,[ip] => 10.250.31.180,[timestamp] => 1608232769)) called at [/sites/all/modules/contrib/rules/modules/events.inc:200]
#13 rules_watchdog(Array ([type] => php,[message] => %type: !message in %function (line %line of %file).,[variables] => Array ([%type] => Warning,[!message] => Use of undefined constant LDAP_DEREF_SEARCHING - assumed 'LDAP_DEREF_SEARCHING' (this will throw an Error in a future version of PHP),[%function] => LdapQuery::fields(),[%file] => /sites/all/modules/contrib/ldap/ldap_query/LdapQuery.class.php,[%line] => 440,[severity_level] => 4),[severity] => 4,[link] => ,[user] => stdClass Object ([uid] => 0,[hostname] => 10.250.31.180,[roles] => Array ([1] => anonymous user),[cache] => 0),[uid] => 0,[request_uri] => https://dev.mysite.byf1.dev/user/reset/1/1608232243/XXX/login,[referer] => ,[ip] => 10.250.31.180,[timestamp] => 1608232769)) called at [/includes/module.inc:965]
#14 module_invoke_all(watchdog, Array ([type] => php,[message] => %type: !message in %function (line %line of %file).,[variables] => Array ([%type] => Warning,[!message] => Use of undefined constant LDAP_DEREF_SEARCHING - assumed 'LDAP_DEREF_SEARCHING' (this will throw an Error in a future version of PHP),[%function] => LdapQuery::fields(),[%file] => /sites/all/modules/contrib/ldap/ldap_query/LdapQuery.class.php,[%line] => 440,[severity_level] => 4),[severity] => 4,[link] => ,[user] => stdClass Object ([uid] => 0,[hostname] => 10.250.31.180,[roles] => Array ([1] => anonymous user),[cache] => 0),[uid] => 0,[request_uri] => https://dev.mysite.dev/user/reset/1/1608232243/XXX/login,[referer] => ,[ip] => 10.250.31.180,[timestamp] => 1608232769)) called at [/includes/bootstrap.inc:2024]
#15 watchdog(php, %type: !message in %function (line %line of %file)., Array ([%type] => Warning,[!message] => Use of undefined constant LDAP_DEREF_SEARCHING - assumed 'LDAP_DEREF_SEARCHING' (this will throw an Error in a future version of PHP),[%function] => LdapQuery::fields(),[%file] => /sites/all/modules/contrib/ldap/ldap_query/LdapQuery.class.php,[%line] => 440,[severity_level] => 4), 4) called at [/includes/errors.inc:210]
#16 _drupal_log_error(Array ([%type] => Warning,[!message] => Use of undefined constant LDAP_DEREF_SEARCHING - assumed 'LDAP_DEREF_SEARCHING' (this will throw an Error in a future version of PHP),[%function] => LdapQuery::fields(),[%file] => /sites/all/modules/contrib/ldap/ldap_query/LdapQuery.class.php,[%line] => 440,[severity_level] => 4), ) called at [/includes/errors.inc:75]
#17 _drupal_error_handler_real(2, Use of undefined constant LDAP_DEREF_SEARCHING - assumed 'LDAP_DEREF_SEARCHING' (this will throw an Error in a future version of PHP), /sites/all/modules/contrib/ldap/ldap_query/LdapQuery.class.php, 440, Array ()) called at [/includes/bootstrap.inc:2603]
#18 _drupal_error_handler(2, Use of undefined constant LDAP_DEREF_SEARCHING - assumed 'LDAP_DEREF_SEARCHING' (this will throw an Error in a future version of PHP), /sites/all/modules/contrib/ldap/ldap_query/LdapQuery.class.php, 440, Array ()) called at [/sites/all/modules/contrib/ldap/ldap_query/LdapQuery.class.php:440]
#19 LdapQuery::fields() called at [/sites/all/modules/contrib/ldap/ldap_query/ldap_query.install:56]
#20 ldap_query_schema() called at [/includes/module.inc:934]
#21 module_invoke(ldap_query, schema) called at [/includes/bootstrap.inc:3362]
#22 drupal_get_complete_schema() called at [/includes/bootstrap.inc:3316]
#23 SchemaCache->resolveCacheMiss(context) called at [/includes/bootstrap.inc:374]
#24 DrupalCacheArray->offsetGet(context) called at [/includes/bootstrap.inc:363]
#25 DrupalCacheArray->offsetExists(context) called at [/includes/bootstrap.inc:3291]
#26 drupal_get_schema(context) called at [/sites/all/modules/contrib/ctools/includes/export.inc:983]
#27 ctools_export_get_schema(context) called at [/sites/all/modules/contrib/ctools/includes/export.inc:396]
#28 ctools_export_load_object(context, all) called at [/sites/all/modules/contrib/context/context.module:287]
#29 context_load(, ) called at [/sites/all/modules/contrib/context/context.module:413]
#30 context_enabled_contexts() called at [/sites/all/modules/contrib/context/context.module:476]
#31 context_condition_map() called at [/sites/all/modules/contrib/context/plugins/context_condition.inc:160]
#32 context_condition->get_contexts(1) called at [/sites/all/modules/contrib/context/plugins/context_condition_sitewide.inc:19]
#33 context_condition_sitewide->execute(1) called at [/sites/all/modules/contrib/context/context.module:169]
#34 context_init() called at [/includes/module.inc:965]
#35 module_invoke_all(init) called at [/includes/common.inc:5388]
#36 _drupal_bootstrap_full() called at [/includes/bootstrap.inc:2550]
#37 drupal_bootstrap(7) called at [/index.php:20]
rcodina’s picture

Given that drush cc all fails when this error shows up, I tried another option which works and doesn't require the patch. I simply truncated all Drupal's cache tables via mysql client:

truncate cache;
truncate cache_admin_menu;
truncate cache_block;
truncate cache_bootstrap;
(...)
markusd1984’s picture

@bburg how did you generate that nice documented backtrace?
Would love to know how to do the same, cheers.

bburg’s picture

Ha, I don't quite remember. I was scrambling at the time to debug the issue, so I'm not sure if it was just the normal display errors setting, or if I did something like dump the output of debug_backtrace().

alex_web’s picture

Hi guys. Can you tell me how to apply this patch? With the drush module? And how to install the module without access to the site admin panel?

bburg’s picture

@Alex_web

Here is an SO post with some tips on applying patches https://drupal.stackexchange.com/a/23356/75558

This is a bit of an older issue, and I think that patch file was for D7. So it might not apply.

In my own workflow on D8+ sites, I use composer, and with that package management tool, you can list patch files you want to apply, and it will apply them automatically.

For quick testing in my local environment though, I tend to just run something like this from inside the module directory:

curl https://www.drupal.org/files/issues/fix_null_entity_fields.patch | patch -p1

This makes a curl request for the patch file, and pipes that into the patch command, which will apply the patch in the current directory. Make sure your system supports pipes though, some windows environments might not.