Support

Home Forums Event Espresso Premium espresso_display_ticket_selector not defined

espresso_display_ticket_selector not defined

Posted: October 3, 2022 at 11:50 am


Peyton Earey

October 3, 2022 at 11:50 am

trying to upgrade to php8 but getting a critical error from a custom function in the theme. Using,

if ( espresso_display_ticket_selector( $post->ID ) && ( is_single() || ( is_archive() && espresso_display_ticket_selector_in_event_list() ))) :

How can the theme code recognize a function in the plugin to be compatible with php8 works in 7.4


Tony

  • Support Staff

October 3, 2022 at 2:08 pm

Hi there,

Where is that code running? I’ll see if I can reproduce this.

If you can add the file to say Pastebin so I can drop it in locally that would be great.


Peyton Earey

October 3, 2022 at 2:30 pm

https://pastebin.com/SVU4wYXh

Line 34. We’re including this file in our theme from the functions file.
works with PHP 7.4 but not 8.1


Peyton Earey

October 3, 2022 at 2:46 pm

This reply has been marked as private.


Tony

  • Support Staff

October 3, 2022 at 4:01 pm

We don’t officially support PHP8.1 as it stands and if you have the option for PHP8, I’d use that over PHP8.1 currently.

PHP8.1 throws a bunch of deprecated notices because of the changes made and is also much stricter on type control, which has never been the case with PHP previously.

Now, having said that I did test the above locally using PHP8.1 and didn’t run into a fatal error from that code.

The functions mentioned above are within \event-espresso-core-reg\public\template_tags.php, we hook into the ‘init’ wp core action to load Event Espresso. It’s actually one of the very few files we included on all requests because it can be run by page builders so its odd your getting the above.

You could try including the file manually:

include_once EE_PUBLIC . 'template_tags.php';

As it stands it only used in that one function so you could add that to line 33.

However, its odd that I’m not getting the error at all here, I’m not sure why that would be the case.


Peyton Earey

October 4, 2022 at 8:08 am

I do get a different fatal error when including that. Our host is not going to support PHP 7 after November. Are there no plans for 8 compatibility?

Here is the new error when clicking on download PDF:

Fatal error: Uncaught Dompdf\Exception: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated 8192 in /www/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/src/Helpers.php:507


Tony

  • Support Staff

October 4, 2022 at 9:47 am

Are there no plans for 8 compatibility?

The latest version of Event Espresso 4 (4.10.40.p) is already compatible with PHP8.0

PHP8.1 brings in a lot more breaking changes, we don’t have full compatibility with it yet… although for the most part 8.1 works for me, it just throws a bunch of deprecated notices.

The error you are getting means you are using an older version of EE4, please update to the latest version and see if you still get an error then.


Peyton Earey

October 5, 2022 at 9:00 am

Dang, that was it. I was on 4.10.38. 4.10.40 is the fix. Didn’t see the upgrade because I needed to reset the key after moving the wp directory.
thanks for helping me through this.


Tony

  • Support Staff

October 5, 2022 at 9:03 am

You’re most welcome, I’m glad its working for you now 🙂

The support post ‘espresso_display_ticket_selector not defined’ 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