Fatal error: Call to undefined function entityreference_get_behavior_handlers() in C:\xampp\htdocs\recruiter\profiles\recruiter\modules\entityreference\entityreference.install on line 44

Files: 
CommentFileSizeAuthor
#20 entityreference-1836106-20.patch614 bytescs_shadow
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]
#17 entityreference-1836106-17.patch613 bytescs_shadow
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in sites/default/modules/entityreference/entityreference.install.
[ View ]
#8 1836106.patch625 bytesRobLoach
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]

Comments

Priority:Critical» Normal

Can you give some more information to reproduce this bug?

Status:Active» Postponed (maintainer needs more info)

I agree with downgrading the priority until there's a clear set of steps to repeat the bug (as kscheirer did in #1).

Also updating the status.

Status:Postponed (maintainer needs more info)» Closed (duplicate)

Status:Closed (duplicate)» Active

Hi, I got this error when moving a site from d7.1x to d7.19 on pantheon - specifically when using Drush. The site would show a maintenance mode screen.

The bug marked duplicate didn't address the issue, and the patch didn't apply.

To fix, I added this line to the top of entityreference.install:

require_once "entityreference.module";

A call stack:
quickstart@qs10:~/websites/nvbarcle.dev$ drush cc all

Fatal error: Call to undefined function entityreference_get_behavior_handlers() in /home/quickstart/websites/nvbarcle.dev/sites/all/modules/entityreference/entityreference.install on line 44

Call Stack:
0.0004 707712 1. {main}() /home/quickstart/drush/drush.php:0
0.0230 5140824 2. drush_main() /home/quickstart/drush/drush.php:14
0.1696 15852136 3. _drush_bootstrap_and_dispatch() /home/quickstart/drush/drush.php:59
0.2274 15859360 4. drush_bootstrap_to_phase() /home/quickstart/drush/drush.php:79
0.2274 15859360 5. drush_bootstrap_max() /home/quickstart/drush/includes/bootstrap.inc:291
0.4431 42284120 6. drush_bootstrap() /home/quickstart/drush/includes/bootstrap.inc:345
0.4446 42286760 7. _drush_bootstrap_drupal_login() /home/quickstart/drush/includes/bootstrap.inc:185
0.4449 42287056 8. drush_drupal_login() /home/quickstart/drush/includes/bootstrap.inc:949
0.4449 42287056 9. user_load() /home/quickstart/drush/includes/drupal.inc:138
0.4449 42287880 10. user_load_multiple() /home/quickstart/websites/nvbarcle.dev/modules/user/user.module:366
0.4449 42288016 11. entity_load() /home/quickstart/websites/nvbarcle.dev/modules/user/user.module:291
0.4449 42288016 12. entity_get_controller() /home/quickstart/websites/nvbarcle.dev/includes/common.inc:7729
0.4449 42288928 13. entity_get_info() /home/quickstart/websites/nvbarcle.dev/includes/common.inc:7760
0.4486 42494328 14. drupal_schema_fields_sql() /home/quickstart/websites/nvbarcle.dev/includes/common.inc:7592
0.4486 42494408 15. drupal_get_schema() /home/quickstart/websites/nvbarcle.dev/includes/common.inc:6981
0.4492 42496304 16. DrupalCacheArray->offsetExists() /home/quickstart/websites/nvbarcle.dev/includes/bootstrap.inc:0
0.4492 42496304 17. DrupalCacheArray->offsetGet() /home/quickstart/websites/nvbarcle.dev/includes/bootstrap.inc:345
0.4492 42496304 18. SchemaCache->resolveCacheMiss() /home/quickstart/websites/nvbarcle.dev/includes/bootstrap.inc:356
0.4492 42496304 19. drupal_get_complete_schema() /home/quickstart/websites/nvbarcle.dev/includes/bootstrap.inc:2946
0.4699 46234936 20. module_invoke() /home/quickstart/websites/nvbarcle.dev/includes/bootstrap.inc:2992
0.4699 46235488 21. call_user_func_array() /home/quickstart/websites/nvbarcle.dev/includes/module.inc:833
0.4699 46235856 22. field_sql_storage_schema() /home/quickstart/websites/nvbarcle.dev/includes/module.inc:0
0.4732 46656448 23. field_read_fields() /home/quickstart/websites/nvbarcle.dev/modules/field/modules/field_sql_storage/field_sql_storage.install:16
0.5131 47160456 24. module_invoke() /home/quickstart/websites/nvbarcle.dev/modules/field/field.crud.inc:373
0.5133 47163336 25. call_user_func_array() /home/quickstart/websites/nvbarcle.dev/includes/module.inc:833
0.5133 47163824 26. entityreference_field_schema() /home/quickstart/websites/nvbarcle.dev/includes/module.inc:0

Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to undefined function entityreference_get_behavior_handlers() in /home/quickstart/websites/nvbarcle.dev/sites/all/modules/entityreference/entityreference.install, line 44
Drush was not able to start (bootstrap) Drupal. [error]
Hint: This error can only occur once the database connection has already been successfully initiated, therefore this error generally points to a site configuration issue, and not a problem connecting to the database.

Drush was attempting to connect to:
Drupal version : 7.19
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database username : nvbarcle_dev
Database name : nvbarcle_dev
Database : Connected
Default theme : nvbar
Administration theme: seven
PHP configuration : /etc/php5/cli/php.ini
Drush version : 5.7
Drush configuration:
Drupal root : /home/quickstart/websites/nvbarcle.dev
Site path : sites/default
Modules path : sites/all/modules
Themes path : sites/all/themes
File directory path: sites/default/files
Private file directory path: sites/default/private
temp : tmp
%paths : Array

Version:7.x-1.x-dev» 7.x-1.0

For whatever reason, all contrib modules were disabled in the database (inc EntityReference)

Something is attempting to use entityreference when it's disabled. It's a database error for my site so I have to back and fix something else.

#4 did the job.

Version:7.x-1.0» 7.x-1.x-dev
Issue tags:+Novice

Awesome, want to create a simple patch that does that? It should go against 1.x-dev.

Status:Active» Needs review
StatusFileSize
new625 bytes
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]

Status:Needs review» Closed (duplicate)

Status:Closed (duplicate)» Reviewed & tested by the community

I do not think this issue is a duplicate of that other one.

I got this problem today after trying to create a development copy of a running site on my test server using Backup and Migrate.

The database was successfully migrated, but the site didn't come up.

I checked the {system} table and entityreference module's status was 1 (enabled), and yet this error occurred and I couldn't visit any pages on my site.

Applying the patch in #8 fixed the problem.

Since this error can apparently come up without having entityreference being disabled, would you consider adding this patch to the module? The patch should not hurt anything, and it does seem that the error can be triggered even though the module is enabled. Granted, it was after a Backup and Migrate restore to migrate a site to a different host, but as it's a simple fix and it did fix the problem... please? :)

Thank you for the patch. If anyone needs to know, I encountered this error whilst restoring a development backup onto the production site using Backup and Migrate. I too got the patch in #8 to work. If more details are needed, just holler.

I'm working on an install profile which includes some dummy content. I also encountered this bug, and #8 fixed the problem for me too. It looks low risk and now has three community reviews, please can it be committed?

Fourth confirmation this patch fixes the problem!

Issue summary:View changes

Thanks for the patch. Two notes though:

(1) using require_once is not recommended usually. See here and here.

(2) although the patch fixes the problem, It seems to be a temporary solution. I think the module file should be loaded if we are in the .install file, no? This might be a symptom of an underlying problem, maybe #1459540: People seems to be able to disable a Field module which still has fields, and core seems to call field hooks on disabled modules?

Status:Reviewed & tested by the community» Closed (duplicate)

The patches posted at #1459540: People seems to be able to disable a Field module which still has fields, and core seems to call field hooks on disabled modules seem more thought-out than this one, see comments 47 and 58. I'd argue in favor of marking this issue as a duplicate, unless someone can demonstrate why it is better to explicitly load the module file instead of just ignoring the function call if the module does not exist.

Status:Closed (duplicate)» Needs work

#14.1 Good point about require_once, I think we should be using drupal_load(), or possibly module_load_include().

#14.2 There are some cases where the .module will not be loaded before a .install. To quote the drupal_load() change request, "The function [is] used to manually load .module or module-related include files when these [are] not loaded automatically, for example to load a disabled module's .module file during uninstallation."

#15 Please be cautious closing issues, as it makes them a lot less visible. I don't see why the patches on the other issue are better thought out. In my example (creating dummy content in an install profile) I expect the patches on #1459540 would mean that instead of the fatal error I'd get incorrect or missing content, which could be considered worse. #8 means my code still runs as intended and creates the required content.

Setting to needs work, as I think we need a patch similar to #8 but not using require_once.

Status:Needs work» Needs review
StatusFileSize
new613 bytes
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in sites/default/modules/entityreference/entityreference.install.
[ View ]

Attaching patch that uses drupal_load() instead of require_once.

Status:Needs review» Needs work

The last submitted patch, 17: entityreference-1836106-17.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new614 bytes
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]

Missed the semicolon in last patch.