If in include image captcha as a dependency in my profile.info.yml it image_captcha_requirements fails with:

Fatal error: Call to undefined function _image_captcha_check_setup() in /home/matslats/localhost/drupal8/modules/contrib/captcha/image_captcha/image_captcha.install on line 17

This function is in the .module file which hasn't been included.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

matslats created an issue. See original summary.

jamin_melville’s picture

patch gets around issue of module_load_include('module', 'image_captcha') returning false by using include_once instead.

module_load_include('module', 'image_captcha') method calls drupal_get_path('module', 'image_captcha') which returns an empty string.

drupal_get_path('module', 'image_captcha') calls drupal_get_filename('module', 'image_captcha') which returns NULL.

kerby70’s picture

#2 works. I have tested this, on install added as a dependency of a copy of the lightning distribution, without any errors or unexpected behavior.

Calls to hook_requirements during installation of Drupal, such as an installation profile, will not have access to all Drupal API's (per comment on .

Relates to #704110: Prevent installation of image CAPTCHA module when no GD available (with support for installation profiles), unlike that solution using __DIR__ (supported in PHP 5.3+) is more efficient, than dirname(__FILE__).

elachlan’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the RTBC

Status: Fixed » Closed (fixed)

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