How to get the full stack trace for WordPress “table doesn’t exist” error in debug.log?

I’m getting a WordPress “table doesn’t exist” error in my debug.log, but unlike most errors it doesn’t give a full stack trace to help me isolate the code. Anyone know how to tell WordPress to dump a full stack trace for this error? Thanks!

[03-Apr-2021 08:19:39 UTC] WordPress database error Table '**********.wp_47_wslusersprofiles' doesn't exist for query SELECT id, object_sha FROM `wp_47_wslusersprofiles` where user_id = 33 and provider = 'Google' and identifier = '115473556036777077042' made by require('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, wsl_process_login, wsl_process_login_end, wsl_process_login_update_wsl_user_data, wsl_store_hybridauth_user_profile

More context: I know the wslusersprofiles table isn’t a standard WordPress table. What puzzles me is why I’m not getting a normal stack trace in my debug.log file like I would for a PHP Error, Warning, or Notice. It’s as if the WordPress database class is trapping this error and only issuing an error_log() notification, without throwing a PHP error. Is there a way to force it to throw an exception? Or at least dump more details?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You are not seeing a stack trace because this information is being logged via the error_log() function within the wpdb::print_error() method. error_log() simply sends a message to the logs.

The behaviour you’re expecting with a full stack trace would require trigger_error() to be used.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x