I am running CiviCRM 5.20.1 with WordPress 5.3.2. We have decided to redefine a membership type (actually an annual recertification) and I needed to delete the current members before I upload a sanitized version of the data (error free and more complete data).

I originally posted this question believing the memberships had not be deleted. They were. It would still be nice to fix this appearance of a problem.

Anyway, I am getting the following error when I delete the current members:

 Notice: Undefined offset: 1260 in
 **/home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php** on line **632**

 **Fatal error:** Uncaught Error: Call to a member function delete() on
 null in /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php:664

Stack trace: 
#0 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php(613): CRM_Member_BAO_Membership::deleteMembership('1260', false) 
#1 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Task/Delete.php(83): CRM_Member_BAO_Membership::del('1260') 
#2 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(495): CRM_Member_Form_Task_Delete->postProcess() 
#3 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Done.php(75): CRM_Core_Form->mainProcess() 
#4 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Done->perform(Object(CRM_Member_Form_Task_Delete), 'done') 
#5 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Pa 

in **/home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php** on line **664** There has been a critical error on your website. Please check your site admin email inbox for instructions. 

 Learn more about debugging in WordPress.

I've looked at the lines in question, but I don't see (or understand) the problem. Any suggestions to move this project forward?

  • Is there an associated error in your Civicrm ConfigAndLog Log? It sometimes will have more information. civicrm.org/extensions/civicrm-log-viewer Feb 24 '20 at 19:30
  • @LyonsDigital This error message is incomplete. I reformatted it to make it clear that step 5 is missing data, as is the line below. Could you please check your log and fill in missing parts, especially extra steps? Feb 24 '20 at 19:53
  • Also, confirm that the membership with ID 1260 still exists? Feb 24 '20 at 19:55

The error is happening in the deleteMembership function, and the error says: you're trying to execute the method "delete" on an empty (i.e. null) object. The object that is "null" is expected to be a membership object.

That suggests that the code might have been running two copies in parallel - e.g. perhaps you clicked twice on the delete button (would not be difficult, since you're trying to do a mass delete on a lot of memberships).

  • Not sure how to test this hypothesis, but it's entirely likely. Feb 26 '20 at 16:39
  • Try repeating your mass membership delete?
    – Alan Dixon
    Feb 26 '20 at 21:06

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.