Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-1957

CRM_Utils_Hook_Drupal doesn't wrap

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Won't Fix
    • Affects Version/s: 1.7
    • Fix Version/s: 1.8
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      In CRM_Utils_Hook_Drupal, this method doesn't wrap a call to modulelist() in a function_exists() test. If CiviCRM isn't properly initialized, and thus module_list() doesn't exist, this leads to an API call exiting without returning an error code.

      CRM/Utils/Hook/Drupal.php::85-93:
      function pre( $op, $objectName, $id, &$params ) {
      // copied from user_module_invoke
      foreach ( module_list() as $module) {
      $function = $module . '_civicrm_pre';
      if ( function_exists( $function ) )

      { $function( $op, $objectName, $id, $params ); }

      }
      }

      Proposed modification:

      function pre( $op, $objectName, $id, &$params ) {
      // copied from user_module_invoke
      if (function_exists( 'module_list')) {
      foreach ( module_list() as $module) {
      $function = $module . '_civicrm_pre';
      if ( function_exists( $function ) )

      { $function( $op, $objectName, $id, $params ); }

      }
      }
      }

      This was prompted when a call to crm_create_contact_membership() simply exited when called from a php script that wasn't correctly initialized.

        Attachments

          Activity

            People

            • Assignee:
              sunil Sunil Pawar
              Reporter:
              syoumans Scott Youmans
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: