Support

Home Forums Event Espresso Premium Update is causing critical errors and now our live events won't display

Update is causing critical errors and now our live events won't display

Posted: April 25, 2023 at 12:59 pm

Viewing 3 reply threads


jbroner

April 25, 2023 at 12:59 pm

We are getting fatal errors after updating plugin. This is dire as we have live events. Example snippet – Fatal error: Uncaught TypeError: Return value of EE_Attendee::get_most_recent_registration_for_event() must be an instance of EE_Registration, null returned in


Tony

  • Support Staff

April 25, 2023 at 1:49 pm

Hi there,

I’ve created a ticket for our developers to investigate this.

In the meantime you can change:

/event-espresso-core-reg/core/db_classes/EE_Attendee.class.php

Line 575 should be something like:

public function get_most_recent_registration_for_event(int $event_id): EE_Registration

Change it to be:

public function get_most_recent_registration_for_event(int $event_id): ?EE_Registration

The ? before the return type allows for it to be null.

Generally, we don’t recommend editing core files at all. However, we will likely include a fix for this in the next update so on this occasion it should be fine.

We’ll get this fixed up in an update asap.


jbroner

April 25, 2023 at 1:52 pm

This reply has been marked as private.


Tony

  • Support Staff

April 25, 2023 at 2:08 pm

That custom function checks for a previous registration on the event loaded and displays a message stating the user has previously registered onto the event if it finds one.

The problem is the get_most_recent_registration_for_event() method has been set up to always return an EE_Registration, but that’s not the case, if the attended doesn’t have a registration on the event it wont return an EE_Registration.

So this line $registration = $contact->get_most_recent_registration_for_event($post->ID);

Is showing the problem, but it’s not actually the root cause, the fix I gave you above should fix it so you can keep using the above code and we’ll include that fix in an update.

Viewing 3 reply threads

The support post ‘Update is causing critical errors and now our live events won't display’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso