Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top