For some reason, the Scheduled Job for Update Membership Statuses has not been working on my site for some time. When I run it, I get the following error message:

Fatal error: Call to a member function delete() on a non-object in /home/neftempo/public_html/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php on line 665

I just updated the site from 4.6.8 to 4.7.4 and the problem was not resolved.

Can someone please suggest how to resolve this problem - we need to update our membership statuses.

p.s. The site is hosted on a shared server, so I do not have access to the actual log files - hopefully the above provides sufficient guidance.

  • are any types of Scheduled Jobs working?
    – petednz - fuzion
    Commented Mar 18, 2016 at 0:00
  • For some reason, cron has not been running. However, I did manually run the following scheduled jobs: CiviCRM Update Check, Clean-up Temporary Data and Files, Disable expired relationships, Process Inbound Emails, Send Scheduled Mailings, and Send Scheduled Reminders; and all ran successfully. I will try to insert some debug code and I will ask for copies of the log file.
    – GRoston
    Commented Mar 21, 2016 at 1:26
  • Great. When you get them please update your question with all the information you‘ve uncovered! (I‘m pretty stoked to find out the cause of this!)
    – JohnFF
    Commented Mar 21, 2016 at 1:36
  • I may have found something interesting: At line 658 of Membership.php, I inserted a fwrite of $membershipId. The first $membershipId belongs to a member whose membership arises because he belongs to an organization that is a member. The various values in array $membership that I could figure out seem to be correct. What is really strange is that the second time function deleteMembership is called, the same value of $membershipId is passed in! This would explain (I think) the error because array $membership is empty since this membership has already been deleted. Wonder why...
    – GRoston
    Commented Mar 23, 2016 at 2:39
  • Just some more info: The membership of the organization with which the aforementioned member is associated has expired. The member does not have any special relationship with the organization - he is simply an employee. Based on these notes, is there anything specific for which you (all) think I should look?
    – GRoston
    Commented Mar 23, 2016 at 2:41

1 Answer 1


I took a look at the code for you, and I couldn't see a stand out problem. The bad news is that you need a developer to look at this, insert debug information (or run it in the debugger) and really figure out what's going on.

Most helpful would be if you requested the logs from your SysAdmin, and then posted back when you have them. We need to figure the path of execution.

Do you have custom extensions installed, and does it work if they are disabled?

  • The only extensions installed are: Related Permissions Module, CiviDiscount, and Mailchimp. I disabled all three, cleared the cache, and tried again - same result.
    – GRoston
    Commented Mar 21, 2016 at 1:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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