wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Uncaught Yoast\WP\SEO\Introductions\Domain\Invalid_User_Id_Exception: Invalid User ID

Open Dekadinious opened this issue 10 months ago • 4 comments

  • [X] I've read and understood the contribution guidelines.
  • [X] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

After updating to the latest versions we get uncaught exception on some requests (seems like bot probing requests, but still):

A critical PHP error was triggered

Page: https://domain.tld/post.php

Device Info: IP: ****** Browser: Mozilla/5.0 (Linux; Android 10; ELE-AL00 Build/HUAWEIELE-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/117.0.5938.60 Mobile Safari/537.36 Mobile: yes

Last error: Type: 1 Message: Uncaught Yoast\WP\SEO\Introductions\Domain\Invalid_User_Id_Exception: Invalid User ID in /www/any/wp-content/plugins/wordpress-seo/src/introductions/infrastructure/introductions-seen-repository.php:45 Stack trace: #0 /www/any/wp-content/plugins/wordpress-seo/src/introductions/infrastructure/introductions-seen-repository.php(84): Yoast\WP\SEO\Introductions\Infrastructure\Introductions_Seen_Repository->get_all_introductions() #1 /www/any/wp-content/plugins/wordpress-seo-premium/src/integrations/admin/ai-fix-assessments-integration.php(157): Yoast\WP\SEO\Introductions\Infrastructure\Introductions_Seen_Repository->is_introduction_seen() #2 /www/any/wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Premium\Integrations\Admin\Ai_Fix_Assessments_Integration->enqueue_assets() #3 /www/any/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #4 /www/any/wp-includes/plugin.php(517): WP_Hook->do_action() #5 /www/any/wp-includes/script-loader.php(2456): do_action() #6 /www/any/wp-includes/class-wp-hook.php(324): wp_common_block_scripts_and_styles() #7 /www/any/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #8 /www/any/wp-includes/plugin.php(517): WP_Hook->do_action() #9 /www/any/wp-includes/script-loader.php(2272): do_action() #10 /www/any/wp-includes/class-wp-hook.php(324): wp_enqueue_scripts() #11 /www/any/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #12 /www/any/wp-includes/plugin.php(517): WP_Hook->do_action() #13 /www/any/wp-includes/general-template.php(3064): do_action() #14 /www/any/wp-content/themes/----/header.php(37): wp_head() #15 /www/any/wp-includes/template.php(810): require_once('/www/any/wp-con...') #16 /www/any/wp-includes/template.php(745): load_template() #17 /www/any/wp-includes/general-template.php(48): locate_template() #18 /www/any/wp-content/themes/----/404.php(7): get_header() #19 /www/any/wp-includes/template-loader.php(106): include('/www/any/wp-con...') #20 /www/any/wp-blog-header.php(19): require_once('/www/any/wp-inc...') #21 /www/any/index.php(17): require('/www/any/wp-blo...') #22 {main} thrown File: /www/any/wp-content/plugins/wordpress-seo/src/introductions/infrastructure/introductions-seen-repository.php Line: 45

To Reproduce

Step-by-step reproduction instructions

I am unsure because it has to be something in the post data because I can't reproduce it exactly.

Expected results

  1. No critical error.

Actual results

  1. Critical error.

Used versions

  • PHP version: 8.3.12
  • WordPress version: 6.7.2
  • WordPress Theme: Proprietary
  • Yoast SEO version: 24.5 (Premium: 24.5 - WooCommerce: 16.5)

Dekadinious avatar Feb 20 '25 07:02 Dekadinious

Hi @Dekadinious

Thanks for using the Yoast SEO plugin and for creating the issue. I tried multiple times to replicate the issue; however, even after keeping a site live for a week and directly accessing post.php, I couldn't trigger the critical error in the log. It seems the error is caused by some other factor which is unknown as you have mentioned.

I’ll keep this issue open. If anyone has identified the steps to reproduce it, please share the detailed steps so we can investigate further.

josevarghese avatar Mar 05 '25 08:03 josevarghese

I don't quite know. We have premium and we have for WooCommerce also. Could there be code inside those throwing such an exception and code elsewhere that fails to catch?

Dekadinious avatar Mar 05 '25 09:03 Dekadinious

This is getting quite annoying because we have a lot of bots trying to hit pages that do not exist with post requests because they are trying to find security vulnerabilities, and when they do they trigger this fatal error which in turn notifies me of a fatal error. I would think you just need to catch it where you use it because you should expect it to be able to be thrown?

Dekadinious avatar Mar 18 '25 10:03 Dekadinious

Hi @Dekadinious

We could not confirm which plugin is causing this as we cannot replicate it at our end, but it seems like some bots hitting your website are causing it and we haven't yet heard about this from others. If you get a chance to find out the steps to replicate it, please let us know.

josevarghese avatar Mar 18 '25 13:03 josevarghese