Support

Home Forums Event Espresso Premium PHP Fatal error: Uncaught

PHP Fatal error: Uncaught

Posted: February 28, 2023 at 6:52 am

Viewing 7 reply threads


haysmacintyre

February 28, 2023 at 6:52 am

Please advise:

10am this morning Event espresso is hitting this error

[28-Feb-2023 12:38:58 UTC] PHP Fatal error: Uncaught EventEspresso\core\exceptions\InvalidDataTypeException: The supplied data for "$name" was an integer, but a string was expected. in /home/haysmaci/public_html/wp-content/plugins/event-espresso-core-reg/core/domain/entities/notifications/PersistentAdminNotice.php:128
Stack trace:
#0 /home/haysmaci/public_html/wp-content/plugins/event-espresso-core-reg/core/domain/entities/notifications/PersistentAdminNotice.php(98): EventEspresso\core\domain\entities\notifications\PersistentAdminNotice->setName(82617817)
#1 /home/haysmaci/public_html/wp-content/plugins/event-espresso-core-reg/core/services/notifications/PersistentAdminNoticeManager.php(159): EventEspresso\core\domain\entities\notifications\PersistentAdminNotice->__construct(82617817, ‘1677613999’, false, ‘manage_options’, ‘view persistent…’, false)
#2 /home/haysmaci/public_html/wp-content/plugins/event-espresso-core-reg/core/services/notifications/PersistentAdminNoticeManager.php(111): EventEspresso\core\services\notifications\PersistentAdminNoticeManager->retrieveStoredNotices()
#3 /home/haysmaci/public_html/wp-content/plugins/event-espresso-core-reg/core/services/notifications/PersistentAdminNoticeManager.php(211): EventEspresso\core\services\notifications\PersistentAdminNoticeManager->getPersistentAdminNoticeCollection()
#4 /home/haysmaci/public_html/wp-includes/class-wp-hook.php(308): EventEspresso\core\services\notifications\PersistentAdminNoticeManager->displayNotices(”)
#5 /home/haysmaci/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#6 /home/haysmaci/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#7 /home/haysmaci/public_html/wp-admin/admin-header.php(303): do_action(‘admin_notices’)
#8 /home/haysmaci/public_html/wp-admin/admin.php(239): require_once(‘/home/haysmaci/…’)
#9 {main}
thrown in /home/haysmaci/public_html/wp-content/plugins/event-espresso-core-reg/core/domain/entities/notifications/PersistentAdminNotice.php on line 128


haysmacintyre

February 28, 2023 at 7:12 am

We urgently need a fix for this as no one can access the cms.


haysmacintyre

February 28, 2023 at 8:34 am

Information provided by our client when this occurred:

I just spoke to the team. One of my co-workers was working on Event Espresso last night and had left the tab open. This morning, she went back to the tab (it looked like WP hadn’t logged her out) and tried to add more information to the event and then press Save, and then apparently everything went down and the ‘critical error’ message appeared.
Hopefully this helps sort the issue but let me know if I can help with anything else
Many thanks,


Tony

  • Support Staff

February 28, 2023 at 11:34 am

Hi there,

Sounds like something has been saved within the database option EE uses for the notices that isn’t expected.

Can I take a closer look at this?

Note to do so I’ll need temp WP Admin credentials and FTP/File manager access, if that’s ok you can send those login credentials using this form:

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


haysmacintyre

February 28, 2023 at 12:59 pm

Hi Tony,

I have just sent you all the login / FTP access required, if you could take a look at this ASAP it would be so much appreciated.

Many thanks,
Tonya


Tony

  • Support Staff

February 28, 2023 at 1:13 pm

Hi there,

This should now be fixed.

Somehow a bunch of options had been saved within the option EE uses for notices hat it did not know how to handle. I’ve emptied the option to remove those and the admin should now work again.


haysmacintyre

February 28, 2023 at 1:25 pm

Thanks so much for this Tony, that’s all working great again. Do you think this could happen again? And if so is it worth sharing instructions on how we can fix ourselves? Or was this a really weird one off? Many thanks again, Tonya


Tony

  • Support Staff

February 28, 2023 at 1:48 pm

Do you think this could happen again?

Because I don’t know how it happened, I can’t say either way, unfortunately. I’m going to create a ticket to see if the code throwing the error can handle that a little better but that could still take a while and it happen in the meantime… so….

And if so is it worth sharing instructions on how we can fix ourselves?

Sure, in \event-espresso-core-reg\core\domain\entities\notifications\PersistentAdminNotice.php

Is a setName($name) method.

That method confirms we have a string before trying to set the name of the notice:

if (! is_string($name)) {
    throw new InvalidDataTypeException('$name', $name, 'string');
}

Right before that I did this:

$persistent_admin_notices = get_option(PersistentAdminNoticeManager::WP_OPTION_KEY, array());
var_dump(persistent_admin_notices);

And refreshed the page to get an output of the option so I could see what had been set.

Then I changed that code to be just:

update_option(PersistentAdminNoticeManager::WP_OPTION_KEY, array());

And refreshed the page again.

That change basically sets the option to be an empty array again, removing whatever is saved within it.

For the most part, that’s a safe thing to do in the specific case as the error is being thrown by something trying to display a notice, wiping it out removes that notice but those aren’t critical 99.9% of the time anyway and a critical error is more urgent than whatever is in the notice.

However, I I will say that I’m checking the option beforehand to confirm that and without knowing what your looking for in the option to confirm, you may remove something you need… so this is at your own risk 🙂

Or was this a really weird one off?

Really difficult to say currently (I wish I could give you a better answer).

IF it does happen again on your site, I would be inclined to add a function to the site which writes a log entry of what is being saved and what is saving it until we find the cause. That log is going to get big quickly so it’s only worth doing if the above issue is reproducible.

Viewing 7 reply threads

The support post ‘PHP Fatal error: Uncaught’ 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