• Resolved Jaro

    (@pixtweaks)


    Hi, I have the same problem as this user 8 months ago. https://www.ads-software.com/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-get_userdata/

    Fatal error: Uncaught Error: Call to undefined function get_userdata() in /home5/*********/public_html/wp-includes/user.php:674
    Stack trace: #0 /home5/*********/public_html/wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php(952): get_user_option() #1 /home5/*********/public_html/wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php(939): Yoast_Notification_Center->get_stored_notifications() #2 /home5/*********/public_html/wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php(925): Yoast_Notification_Center->has_stored_notifications() #3 /home5/*********/public_html/wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php(633): Yoast_Notification_Center->remove_storage() #4 /home5/*********/public_html/wp-includes/class-wp-hook.php(324): Yoast_Notification_Center->update_storage() #5 /home5/*********/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #6 /home5/*********/public_html/wp-includes/plugin.php(517): WP_Hook->do_action() #7 /home5/*********/public_html/wp-includes/load.php(1270): do_action() #8 [internal function]: shutdown_action_hook() #9 {main} thrown in /home5/*********/public_html/wp-includes/user.php on line 674

    What’s going on is that I’m serving my ajax request /wp-admin/admin-ajax.php/?my-ajax-id-query-string in hook mu-plugin where function get_userdata() is not declared and Yoast SEO has registered the shutdown function that is calling this function, therefore fatal error.

    PLEASE pass this your developers:
    If you do such a thing as registering shutdown action, please add simple check if anything at all should be actually executed or not. Use simple if( ($_POST['action']??) !== 'yoast-check-notification') {return;} else { requite __DIR__.'/yoast-notification.php';} This one line of code that would take 5 microseconds to execute will save many more seconds of CPU time and hours developers’ time like me debugging silly issues that should never happened in the first place, if good practices been used by so respected and successful plugin like Yoast SEO.
    Look at it this way: you have no business to evaluate if there is your notification to be displayed in not your URL, in this case my AJAX request. This is the biggest problem of WordPress code, running tons of code on requests that has noting to do with given request.

    PLEASE pass this your developers
    PLEASE pass this your developers
    PLEASE pass this your developers

    And please fix in next update, then implement on other parts of the plugin to make WP faster and better to work with.

    Thank you!

    PD: Did mention that this is important for your developers to see it?

  • The topic ‘Fatal Error’ is closed to new replies.