CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Argument #2 is not an array in CRM_Utils_Hook->runHooks()
Pages: [1]

Author Topic: Argument #2 is not an array in CRM_Utils_Hook->runHooks()  (Read 2876 times)

Erawat

  • I’m new here
  • *
  • Posts: 19
  • Karma: 1
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5.3
Argument #2 is not an array in CRM_Utils_Hook->runHooks()
February 17, 2012, 10:13:41 am
Hi all,

I have got this warning after upgraded from CiviCRM 4.0.7 to CiviCRM 4.1

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in CRM_Utils_Hook->runHooks() (line 125 of /var/www/website/sites/all/modules/civicrm/CRM/Utils/Hook.php).

I have no clue how to fix it? 


I'm also having problems with Gift Aid with some hooks after upgraded to CiviCRM 4.1


Any idea to turn this warning off?


Thanks

Erawat

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Argument #2 is not an array in CRM_Utils_Hook->runHooks()
February 17, 2012, 11:41:58 am

When do u get that warning? was it only after the upgrade?

From some forum posts, i dont think gift aid has been working in recent versions of 3.4.x/4.0.x

Veda consulting is planning to take ownership of this module and help support it. So hopefully we'll see some patches for this module for 4.1 sometime soon

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Erawat

  • I’m new here
  • *
  • Posts: 19
  • Karma: 1
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5.3
Re: Argument #2 is not an array in CRM_Utils_Hook->runHooks()
February 19, 2012, 08:11:47 am
Hi Lobo,

Quote from: Donald Lobo on February 17, 2012, 11:41:58 am

When do u get that warning? was it only after the upgrade?


Yes, I get the warning only after the upgrade.

However, I managed to get the Gift Aid module working with CiviCRM 4.0.x.  Yesterday, I was trying to debug why the module stop working since I upgraded.

It's because the signature of function "invoke" in CRM_Utils_Hook_Drupal  has been changed in version 4.1 from static function to normal function


Erawat

AliB

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: D7
  • MySQL version: latest
  • PHP version: 5.3
Re: Argument #2 is not an array in CRM_Utils_Hook->runHooks()
March 07, 2012, 03:33:23 am
I've also been getting this since 4.1 beta. Disabling all of the drupal modules I created which use civicrm hooks fixes the problem even if I keep giftaid there. I've upgraded to the recent release of gift aid.

Hmm.

AliB

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: D7
  • MySQL version: latest
  • PHP version: 5.3
Re: Argument #2 is not an array in CRM_Utils_Hook->runHooks()
March 25, 2012, 06:49:51 pm
Any ideas on this? I'm getting them on every page and the number of notices increases with the number of modules/hooks.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Argument #2 is not an array in CRM_Utils_Hook->runHooks()
March 25, 2012, 08:56:41 pm

Can u debug and figure out where its coming from (and then why?) that will give us an idea of whats happening and how to fix

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Argument #2 is not an array in CRM_Utils_Hook->runHooks()
August 23, 2012, 10:12:54 am
Hi,

I was getting this error on a freshly upgraded D6 / Civi 4.2.beta5 site. Found http://issues.civicrm.org/jira/browse/CRM-9750 and saw that the associated changes had been committed under http://svn.civicrm.org/tools/branches/v4.1/drupal/modules/civicrm_giftaid/ . (The v4.2 branch code appears to be the same apart from code style changes.)

I took the v4.2 code, which is for D7, and made some small changes to make it work with D6:
- 7.x -> 6.x in .info file
- removed $form param from function giftaid_form() in civicrm_giftaid.admin.inc
- added default value for variable_get() in civicrm_giftaid.admin.inc and GiftAid/Utils/Contribution.php (mandatory in D6)
- changed settings URL from admin/config/system/gift-aid to admin/settings/system/gift-aid, in line with D6 conventions.

Also (not a D6-specific change):
- changed wording for the settings form, as it refers to "Basic Rate", which most users would understand to be the Basic Rate of Income Tax, but AFAICS this value is actually now used for the percentage of a donation that can be claimed as Gift Aid, which is not the same thing.

With these changes, the "Argument #2 is not an array" error no longer occurs. In testing, I got as far as...
- creating a contribution through admin UI with Gift Aid ticked - OK;
- verifying that a Gift Aid declaration was created - OK;
- adding the contribution to a batch - BROKEN: db error: "Unknown column 'batch.label' in 'field list'", in query:
Code: [Select]
SELECT contribution.id, contact.id contact_id, contact.display_name, contribution.total_amount, contribution_type.name,
                          contribution.source, contribution.receive_date, batch.label FROM civicrm_contribution contribution
                   LEFT JOIN civicrm_contact contact ON ( contribution.contact_id = contact.id )
                   LEFT JOIN civicrm_contribution_type contribution_type ON ( contribution_type.id = contribution.contribution_type_id )
                   LEFT JOIN civicrm_entity_batch entity_batch ON ( entity_batch.entity_id = contribution.id )
                   LEFT JOIN civicrm_batch batch ON ( batch.id = entity_batch.batch_id )
                   WHERE contribution.id IN (18946)
I checked the civicrm_batch table and, lo and behold, the "label" field changed to "title". I tracked this down to CRM/Upgrade/Incremental/sql/4.2.alpha1.mysql.tpl, rev 40430 by the look of it, possibly for CRM-9834? This, I must admit, had me muttering and grumbling: can it really have been so crucial to rename this field that it justified breaking (and not fixing) any existing code using it, including the code (Gift Aid) that IIRC the batch table was introduced for in the first place? Having got the muttering out of my system, a more constructive comment...

Is there a standard procedure for informing the community of (a) proposed and (b) completed schema changes, so that people can consider their implications? This was raised in 2009 at http://forum.civicrm.org/index.php?topic=8764.0 and answered in the negative.

OK, to fix the db error:
- changed instances of "label" field to "title" in GiftAid/Form/Task/AddToGiftAid.php, GiftAid/Utils/Contribution.php

After that, I was able to create the batch and run the Gift Aid totals report.

So, I've done some D6-specific changes and some non-D6-specific changes. I don't know where the D6 / Civi 4.2 version should live. Is the best thing to separate out my changes into two patches (D6 & generic) & create an issue?

Dave J

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Argument #2 is not an array in CRM_Utils_Hook->runHooks()
August 24, 2012, 06:48:07 am
Quote from: davej on August 23, 2012, 10:12:54 am
So, I've done some D6-specific changes and some non-D6-specific changes. I don't know where the D6 / Civi 4.2 version should live. Is the best thing to separate out my changes into two patches (D6 & generic) & create an issue?

Done: http://issues.civicrm.org/jira/browse/CRM-10704

Dave J

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Argument #2 is not an array in CRM_Utils_Hook->runHooks()

This forum was archived on 2017-11-26.