Support

Home Forums Event Espresso Premium Multiple problems since this weekends update

Multiple problems since this weekends update

Posted: January 29, 2024 at 2:04 pm


bberdahl

January 29, 2024 at 2:04 pm

We are getting multi error messages.

One being a Bad Gate way message 502
The other is the text looks as if it was years old style text and will not hold created event.

Just unable to add next month schedules or see wh is scheduled to come to an event. Just started after the past update.


Rio

  • Support Staff

January 29, 2024 at 5:19 pm

Can you give us more information about the problem you’re experiencing? Can you shoot a video, you can use loom to do it. https://loom.com/

We also recommend to put the error log in this thread so we can see the problem.

Can you also tell us your site system information?
WP Version
Php Version
EE Version.

You also mention that problem since the weekend update? Can you share us what update you did? is it the EE update? or other theme or plugin update you have?
If it’s EE update, what was your prior version?

thanks


bberdahl

January 31, 2024 at 11:59 am

We can’t save a draft or publish any new events with the latest upgrade.

System Information:
WordPress Version: 6.4.2

PHP Version: 8.2.15

MySQL Version: 10.6.16

Event Espresso Version: 5.0.16.p

WordPress Address (URL): https://coolcompressionscpr.com

Site address (URL): https://coolcompressionscpr.com

Error Message:
AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: EE_Admin_Page_CPT::modify_edit_post_link(): Argument #1 ($link) must be of type string, null given, called in /var/www/vhosts/coolcompressionscpr.com/httpdocs/wp-includes/class-wp-hook.php on line 326 and defined in /var/www/vhosts/coolcompressionscpr.com/httpdocs/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page_CPT.core.php:1165\nStack trace:\n#0 /var/www/vhosts/coolcompressionscpr.com/httpdocs/wp-includes/class-wp-hook.php(326): EE_Admin_Page_CPT->modify_edit_post_link()\n#1 /var/www/vhosts/coolcompressionscpr.com/httpdocs/wp-includes/plugin.php(205): WP_Hook->apply_filters()\n#2 /var/www/vhosts/coolcompressionscpr.com/httpdocs/wp-includes/link-template.php(1499): apply_filters()\n#3 /var/www/vhosts/coolcompressionscpr.com/httpdocs/wp-admin/includes/post.php(2184): get_edit_post_link()\n#4 /var/www/vhosts/coolcompressionscpr.com/httpdocs/wp-admin/post.php(234): redirect_post()\n#5 {main}\n thrown in /var/www/vhosts/coolcompressionscpr.com/ht…’, referer: https://coolcompressionscpr.com/wp-admin/admin.php?page=espresso_events&action=create_new&create_new_nonce=2a18456f42


Tony

  • Support Staff

January 31, 2024 at 1:32 pm

Hi there,

This error:

PHP message: PHP Fatal error: Uncaught TypeError: EE_Admin_Page_CPT::modify_edit_post_link(): Argument #1 ($link) must be of type string, null given

Is from code that has been within Event Espresso since version 5.0.0, so it’s been in the release for a long time and wasn’t just introduced in the latest update over the weekend.

Did you update other plugins over the weekend?

It looks like something is hooking into the get_edit_post_link and returning null, as EE is expecting a string it throws a fatal error.


bberdahl

February 1, 2024 at 10:52 am

Hello,

It may be the original code, but it is causing an issue now, perhaps with some new code. I ran a grep -rnw on the plugins and theme files, and following are the only files using this function:

cool_cpr@crack-ajax:~/httpdocs/wp-content$ grep -rnw ‘modify_edit_post_link’ plugins/
plugins/event-espresso-core-reg/core/admin/EE_Admin.core.php:255: add_filter(‘get_edit_post_link’, [$this, ‘modify_edit_post_link’], 10, 2);
plugins/event-espresso-core-reg/core/admin/EE_Admin.core.php:418: public function modify_edit_post_link($link, $id)
plugins/event-espresso-core-reg/core/admin/EE_Admin_Page_CPT.core.php:731: add_filter(‘get_edit_post_link’, [$this, ‘modify_edit_post_link’], 10, 2);
plugins/event-espresso-core-reg/core/admin/EE_Admin_Page_CPT.core.php:1165: public function modify_edit_post_link(string $link, int $id): string
cool_cpr@crack-ajax:~/httpdocs/wp-content$ grep -rnw ‘modify_edit_post_link’ themes
cool_cpr@crack-ajax:~/httpdocs/wp-content$


Tony

  • Support Staff

February 1, 2024 at 11:24 am

It may be the original code, but it is causing an issue now, perhaps with some new code.

I understand, but the point is that code didn’t change with our update over the weekend and it’s been in core for years (November 2022 is the comment for the string typed property which is throwing the error).

So something else on the site is now hooking in and returning null to the get_edit_post_link filter, meaning its been sett to null before our method hooks in so it now it throws a fatal as it expects a string.

I ran a grep -rnw on the plugins and theme files, and following are the only files using this function:

cool_cpr@crack-ajax:~/httpdocs/wp-content$ grep -rnw ‘modify_edit_post_link’ plugins/

But you’re searching for EE’s method name, so yes, that’s going to show up in Event Espresso because that’s the name of our method hooking into the get_edit_post_link hook.

Do you get more results from:

grep -rnw 'get_edit_post_link' plugins/

You can temporarily stop that fatal by changing plugins/event-espresso-core-reg/core/admin/EE_Admin_Page_CPT.core.php:1165 from this:

public function modify_edit_post_link(string $link, int $id): string

To this:

public function modify_edit_post_link($link, $id)

However, the fatal being thrown there is a symptom of some other code on the site hooking to the above hook and returning an unexpected value which EE then tries to use and throws a fatal so I’d recommend finding the code doing that rather than the above ‘fix’.

One option for doing that is using the Health Check & Troubleshooting plugin but first, do a quick Database backup if you don’t have one already (just to be on the safe side).

Then install and activate this plugin:

https://wordpress.org/plugins/health-check/

Add that to the site and go to Dashboard -> Settings -> Site Health -> Troubleshooting.

Enable Troubleshooting mode.

That disables all plugins and switches you back to a default theme, but only for the logged-in Administrator.

Then do to the Admin Bar -> Troubleshooting Mode -> Manage Active Plugins.

Enable Event Espresso in troubleshooting mode.

Test the condition for the fatal above.

The work through enabling each individual plugin that you have active on the site in troubleshooting and test the above between each one to find which one causes the fatal.

It could also be something within the theme, troubleshooting mode in the admin menu lets you switch themes. Test again.

When finished go to Admin Menu -> Disable Troubleshooting mode to switch back to ‘normal’ mode again.


bberdahl

February 1, 2024 at 11:51 am

Thanks for the info. I incorrectly searched your method name versus the hook name, my apologies. There were several plugins calling the get_edit_post_link hook. I disabled one at a time and trying to create an event. It turns out the culprit was the Woocommerce Payments plugin. I have replaced it with Woocommerce Stripe plugin and things seem to be working now.


Tony

  • Support Staff

February 1, 2024 at 12:54 pm

Nice find.

Ironically, the changelog for version 7.1.0 of WCP has this:

Fix – Prevent possible fatal when using get_edit_post_link filter.

In which they added the code to return null for that filter, I’m not so sure returning null when it’s expected to be a string prevents fatal’s elsewhere but it obviously worked for them 🙂

I’ll create a ticket to discuss this further, based on what we use that value for we can possibly relax the typing a little here to allow for null.

The support post ‘Multiple problems since this weekends update’ 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