I'm using the custom PHP feature of CiviCRM to apply patches etc I can't do with a hook.

I have a custom version of CRM/Mailing/Info.php which causes problems when installing an extension. I get the (redacted) error ...

PHP Fatal error:  Cannot redeclare class CRM_Mailing_Info in /custom-code-area/CRM/Mailing/Info.php on line 0, referer: https://example.org/civicrm/admin/extensions?action=add&id=nz.co.fuzion.accountsync&key=nz.co.fuzion.accountsync

When I remove that PHP file, all is well.

Potential culprit

I see that civicrm_rules_civicrm_postProcess() in drupal/modules/civicrm_rules/civicrm_rules.module on line 132 has ...

  require_once 'CRM/Mailing/Info.php';

Could that be the cause? Assuming this is called before the custom code is included.


There are a few files across the system that cannot be over-ridden via the custom php directory. This is primarily because these files are included during the bootstrap process.

I dont think anyone has documented which files or tried to minimize the number of files that can be overridden. I suspect all component Info.php files fall in this bucket and hence you get the above error

Curious as to what custom code you are adding to the Info.php file

| improve this answer | |
  • The New Mailing form's recipients field is s-l-o-w and I'm trying to minimise the # of previous mailings that get fetched from 500 to 50. See line 108. – Ken West May 29 '15 at 2:53
  • I think your short term option is to hack that file directly – Donald Lobo May 29 '15 at 4:43
  • Yep. I expect that form will get some extra love from Tim and Coleman in the near future. So I'm happy for a short-term hack. – Ken West May 30 '15 at 7:33

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.