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 ) )
}
}
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 ) )
}
}
}
This was prompted when a call to crm_create_contact_membership() simply exited when called from a php script that wasn't correctly initialized.