• Resolved oldwebgeek

    (@oldwebgeek)


    Errors surfacing in our PHP logs:

    WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE 1 = 1 AND session_id=’k16jd8b356094f670bs1hog400” at line 1 for query SELECT * FROM WHERE 1 = 1 AND session_id=’k16jd8b356094f670bs1hog400’ made by Pantheon_Sessions\Session_Handler->write, Pantheon_Sessions\Session::get_by_sid

    This plugin is running off a multi-node XtraDB cluster (Galera), mysql v5.7. Engine InnoDB.

    Here’s the fix that resolved the issue.

    In inc/class-session.php, line ~65, (above or below) add:

    $table_name = $wpdb->pantheon_sessions;

    Then change this at line ~68 from:

    $session_row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->pantheon_sessions} WHERE {$column_name}=%s", $sid ) );

    To:

    $session_row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE {$column_name}=%s", $sid ) );

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Thanks for the report, @oldwebgeek!

    I wouldn’t have expected that to be an issue, but I’m glad to hear you tracked down a fix. I applied the change to WP Native PHP Sessions v1.2.3 so you can continue to safely update the plugin.

    Thread Starter oldwebgeek

    (@oldwebgeek)

    Thanks Daniel. That may not have actually fixed the issue because I noticed more of the same log events after I patched my local copy of the plugin the day I posted the initial report. However, I’ve run the plugin update from the WP dashboard and will let you know if I see more of those errors.

    One other item, I also noticed were these errors in our logs, issues are probably related:

    2021-04-09T15:15:21.000Z – – [09-Apr-2021 11:15:21 America/New_York] WordPress database error Incorrect table name ” for query SHOW FULL COLUMNS FROM made by Pantheon_Sessions\Session_Handler->write, Pantheon_Sessions\Session::create_for_sid

    Thread Starter oldwebgeek

    (@oldwebgeek)

    Looks like this is still an issue. At first, I thought is was a string interpolation issue, but somehow $wpdb->pantheon_sessions is empty.

    2021-04-09T17:49:42.000Z - - [09-Apr-2021 13:49:42 America/New_York] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE session_id='b9npncnar5sk687c1oa62jbbt0'' at line 1 for query SELECT * FROM WHERE session_id='b9npncnar5sk687c1oa62jbbt0' made by Pantheon_Sessions\Session_Handler->write, Pantheon_Sessions\Session::create_for_sid, Pantheon_Sessions\Session::get_by_sid

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    @oldwebgeek Darn! Any luck tracking it down further? Are you using something like HyperDB or LudicrousDB?

    Thread Starter oldwebgeek

    (@oldwebgeek)

    No. Still seeing the errors. Doesn’t seem to prevent the plugin from working.

    It’s weird, we’re using Percona XtraDB cluster (Galera).

    • This reply was modified 3 years, 11 months ago by oldwebgeek.

    I have a similar situation:

    [17-Aug-2021 11:30:34 UTC] WordPress database error Table ‘hmprintd_esign.wp_pantheon_sessions’ doesn’t exist for query SELECT * FROM wp_pantheon_sessions WHERE secure_session_id=’1f1df06d2ba954ab7f4b268065b32cc9′ made by shutdown_action_hook, do_action(‘shutdown’), WP_Hook->do_action, WP_Hook->apply_filters, session_write_close, Pantheon_Sessions\Session_Handler->write, Pantheon_Sessions\Session::create_for_sid, Pantheon_Sessions\Session::get_by_sid

    hundreds of rows of this

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Bug fix for WordPress database error’ is closed to new replies.