Support

Home Forums Event Espresso Premium PHP Fatal error – Editing Event

PHP Fatal error – Editing Event

Posted: August 31, 2023 at 11:53 am


David Anderson

August 31, 2023 at 11:53 am

Hello,

We’re having a strange production issue today. Attempting to edit an event produces a Fatal Error. This is only happening for one event – all other events seem to work fine.

Perhaps there’s a data corruption issue with the event?

We’re unable to grant access to the website, but hopefully the stack trace will help:

PHP Fatal error: Uncaught Error: Object of class __PHP_Incomplete_Class could not be converted to string in /wp-includes/formatting.php:1104\\nStack trace:\\n#0 /wp-includes/formatting.php(4690): wp_check_invalid_utf8(Object(__PHP_Incomplete_Class))\\n#1 /wp-includes/post.php(2833): esc_attr(Object(__PHP_Incomplete_Class))\\n#2 /wp-includes/post.php(2733): sanitize_post_field(‘EE_Event’, Object(__PHP_Incomplete_Class), 13234, ‘edit’)\\n#3 /wp-includes/class-wp-post.php(367): sanitize_post(Object(WP_Post), ‘edit’)\\n#4 /wp-includes/post.php(1035): WP_Post->filter(‘edit’)\\n#5 /wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page_CPT.core.php(1438): get_post(13234, ‘OBJECT’, ‘edit’)\\n#6 /wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php(1142): EE_Admin_Page_CPT->_edit_cpt_item()\\n#7 /wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page_CPT.core.php(394): EE_Admin_Page->_route_admin_request()\\n#8 /wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php(747): EE_Admin_Page_CPT->_load_page_dependencies()\\n#9 /wp-includes/class-wp-hook.php(310): EE_Admin_Page->load_page_dependencies(”)\\n#10 /wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(”, Array)\\n#11 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)\\n#12 /wp-admin/admin.php(237): do_action(‘load-toplevel_p…’)\\n#13 {main}\\n\\nNext RuntimeException: Page route "_edit_cpt_item" with the supplied arguments () threw the following exception: Object of class __PHP_Incomplete_Class could not be converted to string in /wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php:1150\\nStack trace:\\n#0 /wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page_CPT.core.php(394): EE_Admin_Page->_route_admin_request()\\n#1 /wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php(747): EE_Admin_Page_CPT->_load_page_dependencies()\\n#2 /wp-includes/class-wp-hook.php(310): EE_Admin_Page->load_page_dependencies(”)\\n#3 /wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(”, Array)\\n#4 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)\\n#5 /wp-admin/admin.php(237): do_action(‘load-toplevel_p…’)\\n#6 {main}\\n thrown in /wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php on line 1150, referer: https://skillbuilders.com/wp-admin/admin.php?s=tuning&_wpnonce=bbef246253&_wp_http_referer=%2Fwp-admin%2Fadmin.php%3Fpage%3Despresso_events&action=-1&month_range&active_status=none&venue&EVT_CAT=-1&use_filters=no&page=espresso_events&route=default&perpage=20&trash_events_nonce=92e3fd218d&paged=1&action2=-1&default_nonce=99b39e5480


Rio

  • Support Staff

August 31, 2023 at 9:57 pm

Thank you. Can you give us more information about the system? Can you go to your EE Dashboard -> Help and Support.

https://monosnap.com/file/b3zSACx5nwmyhLzgsGouVIw4tHgd0F

Thanks


David Anderson

September 1, 2023 at 10:14 am

Certainly…

WordPress Version: 6.3.1
PHP Version: 8.0.29
MySQL Version: 5.7.42
Event Espresso Version: 5.0.9.p


Tony

  • Support Staff

September 1, 2023 at 10:42 am

Have you recently deactivated any plugins/add-ons on the site?


David Anderson

September 1, 2023 at 10:57 am

Not recently – is there a particular plugin that you have in mind?

The error is only happening when trying to edit a particular Event. We can edit all other Events without issue.


Tony

  • Support Staff

September 1, 2023 at 11:05 am

No plugin in mind.

To explain why I’m asking, you will get that error if an object is serialised and saved to the database but then when it tries to load again it can’t find the class related to that object. PHP switches it to __PHP_Incomplete_Class becuase it doesn’t know what else it should be and then if anything checks for a specific class it throws an error.

So, I was wondering it there was something saved with that event which now doesnr load on the site and causes the error.

Hmm so yeah there’s something missing/corrupted I can’t tell you want from the above. If you can send over temp login details AND ftp credentials I can add some debug code to the site to see what is being pulled from the database which will hopefully shed some more light on what is going on.

If that’s OK send them over using this form:

https://eventespresso.com/send-login-details/


David Anderson

September 6, 2023 at 2:49 pm

Hello – now we’re seeing a different fatal error with the latest version of the plugin:

Same user action (trying to edit an existing Event), but a different error.

PHP Fatal error: Uncaught Error: Class “EE_Datetime_Field” not found in /wp-content/plugins/event-espresso-core-reg/core/domain/entities/DbSafeDateTime.php:170


Rio

  • Support Staff

September 7, 2023 at 1:21 am

Hello David,

May we know if you get the chance to send your log-in details?
https://eventespresso.com/send-login-details/

Thanks.


David Anderson

September 7, 2023 at 12:04 pm

After a lot of research, we have the same issue as reported your forum here:

https://eventespresso.com/topic/event-posts-unable-to-be-edited/

With Object Caching turned off, we see this error when creating a new Event, possibly relating to timestamp issues:

“PHP Fatal error: Uncaught InvalidArgumentException: The "edit_tickets" array is invalid therefore the event can not be updated. in /nas/content/live/***/wp-content/plugins/event-espresso-core-reg/caffeinated/admin/extend/events/espresso_events_Events_Hooks_Extend.class.php:457”

In the background, the event is actually created.

We also notice that a number of old events now have publish timestamps of “Nov 30, 1999” which is a PHP default timestamp.

So, my theory is at some point all events were updated/migrated along with an EE plugin update and there was a bug with datestamps.

Now, the class DbSafeDateTime is breaking for an unknown reason relating to Object Caching.


Tony

  • Support Staff

September 13, 2023 at 4:53 am

Hi there,

The check for that exception is this:

if (empty($data['edit_tickets']) || ! is_array($data['edit_tickets'])) {
    throw new InvalidArgumentException(
        esc_html__(
            'The "edit_tickets" array is invalid therefore the event can not be updated.',
            'event_espresso'
        )
    );
}

So edit_tickets is either empty or something other than an array for that exception to be thrown but that doesn’t tell me what is happening with your event unfortunately.

Can I take a look at the event to see if anything stands out?

If so please send temp login details over using this form:

https://eventespresso.com/send-login-details/

Include the ID of an event I can check this within the form on and I’ll take a look


David Anderson

September 14, 2023 at 7:36 am

After performing some debugging on the plugin code, this seems to be related to Object Caching.

With Object Caching enabled, the class EE_Datetime_Field may not always be loaded. This could be due to changes in cache, invalid cache, hosting config, or some other reason.

Anyway, when Object Caching is enabled and EE_Datetime_Field is not available, the following occurs in DbSafeDateTime.php:

__wakeup() calls createFromFormat()
createFromFormat() calls createFromDateTime()
createFromDateTime() uses the class EE_Datetime_Field

The issue is that createFromDateTime() assumes that EE_Datetime_Field is available, when in fact it might not be.

This is why we get…

PHP Fatal error: Uncaught Error: Class “EE_Datetime_Field” not found and perhaps causes the downstream errors reported above.

The support post ‘PHP Fatal error – Editing Event’ 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