The scene is this:

I installed and configured search_api and search_api_solr.
Then I wrapped it into a fetaure (features.module).
From drush running a "drush site-install" that installs the feature results in:

PHP Fatal error: Class 'Apache_Solr_Document' not found in sites/all/modules/contrib/search_api_solr/service.inc on line 278

I guess somethings gets loaded in an unexpected order during the install.

I managed to fix the issue doing a spl_autoload_register() in the constructor in service.inc.

See patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arnested’s picture

Status: Active » Needs review
FileSize
382 bytes
drunken monkey’s picture

Does the attached patch (registering the autoloader in hook_boot() instead of hook_init()) help?

In any case, I suspect Features (or Drush?) is at fault here, as I don't think a module's classes should be used without calling hook_init().

arnested’s picture

Priority: Normal » Minor

Unfortunately your patch did not make any difference.

I agree with you on suspecting features or drush to do weird stuff - so although my patch works I don't consider it a nice solution.

I guess separating search_api and search_api_solr in different features (with the exported config in the last feature) would make a difference. I'll have to try that some day.

guillaumev’s picture

Same issue here, but at the end of an installation profile installation, when cron runs... Note that the issue is there only when installing the platform through drush (no issue when installing manually)

Steven Jones’s picture

Assigned: Unassigned » Steven Jones
Status: Needs review » Needs work

I'm seeing this issue too, and have a fix.

Steven Jones’s picture

Assigned: Steven Jones » Unassigned
Priority: Minor » Normal
Status: Needs work » Needs review
FileSize
592 bytes

The following fixed the issue for me, which was to register the autoloader on hook_install because the hook_init doesn't get called until the next bootstrap of Drupal.

drunken monkey’s picture

Great, thanks a bunch!

Is this working for everyone else, too? Please test! (As I never had problems, I can't really verify.)

arnested’s picture

Steven Jones' patch works for me as well!

And the explanation makes sense to me too :-)

drunken monkey’s picture

Status: Needs review » Fixed

Great, committed.
Thanks again, Steven!

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

"Patch follows" => "See patch"