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 CiviMember (Moderator: Deepak Srivastava) »
  • UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class
Pages: [1]

Author Topic: UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class  (Read 2734 times)

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class
April 09, 2009, 07:13:08 am
Hi,

I get the following error when running UpdateMembershipRecord.php on a site that uses a custom PHP directory:

PHP Fatal error:  Cannot redeclare class CRM_Core_BAO_CustomField in /var/www/html/drupal-6.9/sites/my.domain/civicrm_custom_php/CRM/Core/BAO
/CustomField.php on line 1470

I'm guessing the script should be checking for files in the custom PHP dir ahead of the standard location, but doesn't.

Thanks,

Dave J

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: UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class
April 09, 2009, 08:23:22 am

r u using require_once in your custom code

your best bet would be to put a CRM_Core_Error::backtrace( ); before the two class declaraction (in CiviCRM and your custom template) and see who is the offending culprit

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: UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class
May 29, 2009, 03:29:44 am
Thanks for the response, Lobo, sorry for the delay in responding. Tested again with 2.2.3 .

Quote from: Donald Lobo on April 09, 2009, 08:23:22 am
r u using require_once in your custom code

The only change in the customised CustomField.php is a text change. The problem occurs even if I put an unmodified CustomField.php in (the relevant subdir of) the custom directory. If I remove CustomField.php from the custom directory (keeping all our other customisations in place), the problem disappears and UpdateMembershipRecord.php succeeds.

Quote from: Donald Lobo on April 09, 2009, 08:23:22 am
your best bet would be to put a CRM_Core_Error::backtrace( ); before the two class declaraction (in CiviCRM and your custom template) and see who is the offending culprit

Code: [Select]
backTrace

/var/www/html/mysite/drupal-6.12/sites/all/modules/civicrm/CRM/Core/BAO/CustomField.php, backtrace, 44
/var/www/html/mysite/drupal-6.12/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php, require_once, 39
/var/www/html/mysite/drupal-6.12/sites/all/modules/civicrm/bin/UpdateMembershipRecord.php, require_once, 39

Thanks,

Dave

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: UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class
May 29, 2009, 08:07:49 am

hey davej:

found the bug :)

can you please file an issue. I'll fix it for 2.2.5 Should be a pretty easy patch

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: UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class
May 29, 2009, 09:01:15 am
Quote from: Donald Lobo on May 29, 2009, 08:07:49 am
found the bug :)

can you please file an issue. I'll fix it for 2.2.5 Should be a pretty easy patch

Great, thanks Lobo. Issue created: CRM-4554.

Dave J

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: UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class
May 29, 2009, 09:18:56 am

fixed :)

changeset here: http://fisheye.civicrm.org/changelog/CiviCRM/?cs=21532

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: UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class
May 29, 2009, 10:12:52 am
That fixes it here, thanks Lobo!

Dave

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • UpdateMembershipRecord error with custom PHP directory: Cannot redeclare class

This forum was archived on 2017-11-26.