Support

Home Forums Event Espresso Premium PHP 8.1 Compatibility with Event Espresso

PHP 8.1 Compatibility with Event Espresso

Posted: November 27, 2022 at 4:36 am

Viewing 5 reply threads


Serdar Ugurlu

November 27, 2022 at 4:36 am

Hi there,

we use Event Espresso under the following environment:

WordPress-Version 6.1.1
Aktive Theme: Pukeko (Version 1.2.4)
Aktuelles Plugin: Event Espresso (Version 4.10.40.p)
PHP-Version 8.1.12-he.0

And our Website goes into full Panic Mode with the following exception:

Ein Fehler vom Typ E_ERROR wurde in der Zeile 698 der Datei /is/htdocs/wp12264976_MTRHAHACIW/www/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin.core.php verursacht. Fehlermeldung: Uncaught ValueError: Unknown format specifier "V" in /is/htdocs/wp12264976_MTRHAHACIW/www/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin.core.php:698
Stack trace:
#0 /is/htdocs/wp12264976_MTRHAHACIW/www/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin.core.php(698): sprintf('% Veranstaltung...', '130')
#1 /is/htdocs/wp12264976_MTRHAHACIW/www/wp-includes/class-wp-hook.php(308): EE_Admin->dashboard_glance_items(Array)
#2 /is/htdocs/wp12264976_MTRHAHACIW/www/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#3 /is/htdocs/wp12264976_MTRHAHACIW/www/wp-admin/includes/dashboard.php(362): apply_filters('dashboard_glanc...', Array)
#4 /is/htdocs/wp12264976_MTRHAHACIW/www/wp-admin/includes/template.php(1409): wp_dashboard_right_now('', Array)
#5 /is/htdocs/wp12264976_MTRHAHACIW/www/wp-admin/includes/dashboard.php(271): do_meta_boxes(Object(WP_Screen), 'normal', '')
#6 /is/htdocs/wp12264976_MTRHAHACIW/www/wp-admin/index.php(203): wp_dashboard()
#7 {main}
thrown

It seems as if Event Espresso does NOT work with PHP 8.1 this poses quite a problem with out Website since we need Event Espresso in Order to make money.
PHP 7 will be history with the end of this Month.

When will we be able to use Event Espresso again? What is the Plan in regard to PHP 8.1 ?
Honestly Guys, I never expected this to happen?

What can we do here any suggestions?

Kind Regards
Serdar


Tony

  • Support Staff

November 28, 2022 at 5:19 am

Hi there,

Officially Event Espresso does not fully support PHP8.1, its does support PHP8.0. PHP8 brings a lite of breaking changes as PHP is not starting to (finally) require much more type controls (amongst other things). PHP8.1 expands on that event further. I recommend using PHP8 as it stands, you’ll fine more plugins compatible with PHP8.0 than 8.1.

The error you are getting is from this:

#0 /is/htdocs/wp12264976_MTRHAHACIW/www/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin.core.php(698): sprintf('% Veranstaltung...', '130')

This means the issue here is from the translations on your site.

The sprintf() function uses ‘specifiers’ to know what should be passed into the string and in PHP7 it would accept the usage of % with a single argument and use whatever was passe, in PHP8 that changed and its no longer acceptable.

The particular line of code in question is HERE and within our code it is:

sprintf(
    esc_html(
        _n('%s Event', '%s Events', $events, 'event_espresso')
    ),
    number_format_i18n($events)
);

That code is totally acceptable for PHP8.1 and I don’t get the above error on my sites.

The translation file on your site is changing that to be:

sprintf(
    esc_html(
        _n('% Veranstaltung', '% Veranstaltung', $events, 'event_espresso')
    ),
    number_format_i18n($events)
);

Note the missing s after the % to tell sprintf that a string is being passed. PHP8 does not accept that and throws the fatal error.

So, we need to find where on your site the translations are loading from.

Using FTP or file manager, if you go to /wp-content/uploads/espresso/languages/

What files do you see there?


Serdar Ugurlu

November 29, 2022 at 6:51 am

Hello Tony,

Thank you for your fast response as always!
I went to the Directory you mentioned:

/wp-content/uploads/espresso/languages/

This is what I found there:

`event_espresso-de_DE.mo 0640
event_espresso-de_DE.mo.old 0751
event_espresso-de_DE.po.old 0640
event_espresso-de_DE.po 0640

The numbers are the rights on the files. They are dated June 7th 2018


Tony

  • Support Staff

November 29, 2022 at 2:40 pm

Rename event_espresso-de_DE.mo to something else, for example event_espresso-de_DE-temp.mo

Does that stop the the above error when you test PHP8?

It looks like you have outdated custom translation files above and at least the % Veranstaltung translation within the .po file will need to be fixed using POEdit, a .mo file regenerated and used to replace the current file.

Or, download the latest translations from here:

https://translate.eventespresso.com/projects/event-espresso-4/de/event-espresso-de_de/

And update those custom translations.


Serdar Ugurlu

November 30, 2022 at 8:18 am

Thank you Tony,

You are majesty !
Always a pleasure with you guys.
Greetings to Garth too.

Thank you.


Tony

  • Support Staff

November 30, 2022 at 8:48 am

You’re most welcome 🙂

Just to note again, I currently recommend using PHP8.0.XX for more compatibility than PHP8.1

Viewing 5 reply threads

The support post ‘PHP 8.1 Compatibility with Event Espresso’ 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