I'm getting these notices in encrypt configuration page:

Notice: Use of undefined constant REQUIREMENT_OK - assumed 'REQUIREMENT_OK' in encrypt_requirements() (line 88 of ../sites/all/modules/encrypt/encrypt.install).
Notice: Use of undefined constant REQUIREMENT_OK - assumed 'REQUIREMENT_OK' in encrypt_admin_settings() (line 43 of ../sites/all/modules/encrypt/includes/encrypt.admin.inc).
Notice: Use of undefined constant REQUIREMENT_ERROR - assumed 'REQUIREMENT_ERROR' in encrypt_admin_settings() (line 62 of ../sites/all/modules/encrypt/includes/encrypt.admin.inc)

No idea what I did wrong, I am using Aegir and the key was generated and found with no problem. Then I did a migrate to a different platform and these notices showed up.

EDIT:
I would also like to note, that I changed the key path and it created another key fine, but these notices keep showing up.

Comments

mengi’s picture

Issue summary: View changes

did a edit of what i tried

Grayside’s picture

Noticed this in the 6.x version with a quick test tonight. There is some abuse of the concept of hook_requirements() in the module which spawns lots of errors. Form validation and hook_requirements() alerts are not the same thing.

theunraveler’s picture

Status: Active » Closed (fixed)

This should be fixed in 6.x-1.1 ([#1589300]) and 7.x-1.1 ([#1589298]).

I do not consider this an abuse of hook_requirements(). It is not doing form validation per-se; it's checking to see that the module's requirements have been met, which is exactly what hook_requirements() is for.

Regardless, thanks for creating the issue.

Alan D.’s picture

Title: Use of undefined constant » Use of undefined constant REQUIREMENT_ERROR
Version: 7.x-1.0 » 7.x-1.x-dev

When using the requirements hook, you will need to also include the install inc directly.

i.e.

  // Make sure the installation API is available
  if (!defined('REQUIREMENT_ERROR')) {
    include_once DRUPAL_ROOT . '/includes/install.inc';
  }

To replicate, install a module that uses encrypt().
DO NOT CONFIGURE encrypt()
Trigger the other module to use the encrypt() functions.

Here is the trace:

encrypt_requirements ('runtime')
_webform_edit_wec_textfield(Array)
call_user_func_array ('_webform_edit_wec_textfield', Array)
webform_component_invoke ('wec_textfield', 'edit', Array)
webform_component_edit_form(Array, Array, stdClass (object), Array, , 'wec_textfield')
call_user_func_array ('webform_component_edit_form', Array)
drupal_retrieve_form ('webform_component_edit_form', Array)
drupal_build_form ('webform_component_edit_form', Array)
drupal_get_form('webform_component_edit_form', stdClass (object), Array, , 'wec_textfield')
call_user_func_array ('drupal_get_form', Array)
menu_execute_active_handler ()
Alan D.’s picture

Status: Closed (fixed) » Needs work
Alan D.’s picture

Actually, I getting errors even after configuration :(

encrypt_requirements ('runtime')
_webform_edit_wec_textfield(Array)
call_user_func_array ('_webform_edit_wec_textfield', Array)
webform_component_invoke ('wec_textfield', 'edit', Array)
webform_component_edit_form(Array, Array, stdClass (object), Array, , 'wec_textfield')
call_user_func_array ('webform_component_edit_form', Array)
drupal_retrieve_form ('webform_component_edit_form', Array)
drupal_build_form ('webform_component_edit_form', Array)
drupal_get_form('webform_component_edit_form', stdClass (object), Array, , 'wec_textfield')
call_user_func_array ('drupal_get_form', Array)
menu_execute_active_handler ()

But the workaround given above fixes these errors :)

BTW, this is not a "hack". See system_status().

function system_status($check = FALSE) {
  // Load .install files
  include_once DRUPAL_ROOT . '/includes/install.inc';
  ...
Alan D.’s picture

Issue summary: View changes

edit2

rlhawk’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)

Closing this issue.

Alan D.’s picture

Status: Closed (fixed) » Closed (cannot reproduce)

Nothing seemed to change in the code in the 7.x branches, http://cgit.drupalcode.org/encrypt/tree/encrypt.install, maybe there was an API in Drupal that prevents the issue from occurring?

I've stopped using the module to actually test if it still an issue, but I guess that you did try, triggering a hook_requirements() error or warning at runtime (the status report) and couldn't see the error. So I have changed the status accordingly to can not replicate.

Note on a site with a million modules, another module may be correctly including that file, so the warning is hidden when it gets here ;)