Support

Home Forums Event Espresso Premium Upgrading to version 5 may have broke our App

Upgrading to version 5 may have broke our App

Posted: September 14, 2023 at 1:32 pm

Viewing 7 reply threads


ty bonlando

September 14, 2023 at 1:32 pm

I’m not sure what details to post, but since EE was upgraded to version 5, the app no longer loads.

I can tell you the app is called JazzYYC and it feeds from JazzYYC.com

Let me know what other info you need and i’ll provide it.


ty bonlando

September 14, 2023 at 2:58 pm

For more context, I am getting an error here:

https://www.jazzyyc.com/wp-json/wp/v2/customEvents

with debug on, i am getting this:

Fatal error: Uncaught TypeError: Argument 1 passed to EE_Event::pretty_active_status() must be of the type bool, null given, called in /home/customer/www/jazzyyc.com/public_html/newsite/wp-content/plugins/event-espresso-core-reg/core/helpers/EEH_Event_View.helper.php on line 110 and defined in /home/customer/www/jazzyyc.com/public_html/newsite/wp-content/plugins/event-espresso-core-reg/core/db_classes/EE_Event.class.php:1243 Stack trace: #0 /home/customer/www/jazzyyc.com/public_html/newsite/wp-content/plugins/event-espresso-core-reg/core/helpers/EEH_Event_View.helper.php(110): EE_Event->pretty_active_status(NULL) #1 /home/customer/www/jazzyyc.com/public_html/newsite/wp-content/themes/jazzyyc/resources/functions.php(104): EEH_Event_View::event_active_status(26841, NULL) #2 /home/customer/www/jazzyyc.com/public_html/newsite/wp-includes/rest-api/class-wp-rest-server.php(1188): eventContent(Object(WP_REST_Request)) #3 /home/customer/www/jazzyyc.com/public_html/newsite/wp-includes/rest-api/class-wp-rest-server.php(1035): WP_RE in /home/customer/www/jazzyyc.com/public_html/newsite/wp-content/plugins/event-espresso-core-reg/core/db_classes/EE_Event.class.php on line 1243


ty bonlando

September 14, 2023 at 3:16 pm

This reply has been marked as private.


ty bonlando

September 14, 2023 at 3:46 pm

This reply has been marked as private.


ty bonlando

September 18, 2023 at 1:47 pm

hopefully someone can review this? I posted some private replies with existing code


Tony

  • Support Staff

September 19, 2023 at 2:41 pm

Hi there,

We don’t provide support for custom code so I need to clarify that the above is not something we provide support for, reviewing custom code to fix bugs within that code would also not be covered under general support.

To get your app working you need to start by first fixing this request:

https://www.jazzyyc.com/wp-json/wp/v2/eventFeatured?1695154625

Notice how when you load that page its throwing a critical error, that’s what you need to start with.

You mentioned you fixed the above, but your code still isn’t correct.

Fatal error: Uncaught TypeError: Argument 1 passed to EE_Event::pretty_active_status()

Is happening because your code is running:

EEH_Event_View::event_active_status($post->ID, $echo);

When $echo hasn’t been defined, so its passing NULL and EE_Event::pretty_active_status() needs either true or false.

Anywhere you have this:

EEH_Event_View::event_active_status($post->ID, $echo);

Change it to be:

EEH_Event_View::event_active_status($post->ID, false);

(You declare $echo = true in one of your functions, but that means your echoing out the value to the page and again, that’s not something you want for these requests so set them to use false regardless)

If your code is still the same from above then fixing both instances of EEH_Event_View::event_active_status() as above will either get your page working again, or show you another fatal error.

i managed to fix the cronfeed issue, but now getting this in the front end

You fixed it? It’s still broken on the live site on the request sent by the app.


ty bonlando

September 19, 2023 at 7:33 pm

This reply has been marked as private.


Tony

  • Support Staff

September 20, 2023 at 2:14 am

Could this have been related to the event espresso 5 update? Because the App was working perfectly before I did this

Sort of.

Your code was using EE_Event::pretty_active_status() incorrectly and one of the parameters being passed was NULL.

PHP is/was ‘loosely typed’, meaning if a function expects a specific type, say an int or bool (true/false) value but you passed in a string or null, PHP will carry on and try to convert/guess what the value should be.

PHP8+ adds much stricter typing within PHP and within PHP8 incorrect types start to throw fatal errors rather than just guessing what it should be (overall this is a good thing, being loosely typed is one of the reasons PHP has a ‘bad’ reputation within the developer community), so within Event Espresso we have started tightening our type declarations and that’s what you have run into here. Passing values to functions that aren’t expected causes problems, setting the type declarations prevents those but means you must use the function correctly or you’ll get fatal errors.

So yes, it’s partially due to the update but the root cause is not using the function correctly.

Viewing 7 reply threads

The support post ‘Upgrading to version 5 may have broke our App’ 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