Getting the following error when installing this extension. Had to enable PHP errors to get this as without all I see is a 500 server error w nothing in the Apache2 logs.

Parse error: syntax error, unexpected 'new' (T_NEW) in /var/www/website.vhost/web/wp-content/uploads/civicrm/ext/uk.co.compucorp.civicrm.giftaid-3.0.1/CRM/Civigiftaid/Utils/Contribution.php on line 99

Ah, v3 of this extension is incompatible with PHP7: https://github.com/compucorp/uk.co.compucorp.civicrm.giftaid/issues/49

  • That sounds like a bug and it is probably worth the report the bug at the extension github. And if you are a developer probably fix the bug. Or fund a developer to fix the bug for you. May 3 '18 at 9:03

The developers are in the process of fixing this: see


So it will probably be fixed in the next release. If you need to install it sooner, here's how. Find your extension directory (go to Administer->SystemSettings->Directories and you will find the path in there. The abbreviation [civicrm.files] usually refers to sites/default/files/civicrm). IN your SSH or FTP environment, navigate to there and then open uk.co.compucorp.civicrm.giftaid/CRM/Civigiftaid/Utils/Contribution.php for editing. Find every line like this:

$batchContribution =& new CRM_Batch_DAO_EntityBatch();

In each case, delete the line and replace it with these two lines:

$entityBatch = new CRM_Batch_DAO_EntityBatch();
$batchContribution =& $entityBatch;

This does not change what the code does but it just changes the syntax to make it compatible with PHP7.

  • I have done as you suggested above, but with no luck. When I try to install, I get the following error.. Parse error: syntax error, unexpected 'new' (T_NEW) in /homepages/21/d758583217/htdocs/health-e-learning/wp-content/uploads/civicrm/ext/uk.co.compucorp.civicrm.giftaid/CRM/Civigiftaid/Utils/Contribution.php on line 99 (If I have the Mailchimp Extension enabled, this gives an error too!) It would be great to know how to repair the damage if I can't use the Extension! Trying to install this extension has also damaged my frontpage too, it no longer looks the way it used too! Please help!
    – Jezzerisin
    Mar 28 '19 at 18:34
  • Well, if you can't use the extension, just disable it; you should not have to repair anything. Also, if you have followed my answer then I don't see how you are getting that error. Can you post what line 99 of that file actually says? Ta.
    – naomi
    Mar 30 '19 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.