Support » Plugin: Avatar Privacy » php notice: SQL Syntax Error

  • Resolved dartrax

    (@dartrax)


    Hi! I noticed getting this messages in php error log:

    [Wed Jul 22 19:45:14.350771 2020] [php7:notice] [pid 20096:tid 1864] [client ::1:54745] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE hash = 'testuser1'' at line 1 for query SELECT * FROM WHERE hash = 'testuser1' made by wp_dashboard, do_meta_boxes, WC_Admin_Dashboard->recent_reviews, get_avatar, get_avatar_url, get_avatar_data, apply_filters('pre_get_avatar_data'), WP_Hook->apply_filters, Avatar_Privacy\\Components\\Avatar_Handling->get_avatar_data, Avatar_Privacy\\Components\\Avatar_Handling->should_show_gravatar, Avatar_Privacy\\Components\\Avatar_Handling->determine_gravatar_policy, Avatar_Privacy\\Core->comment_author_allows_gravatar_use, Avatar_Privacy\\Core->load_data, Avatar_Privacy\\Core->load_data_by_hash, referer: http://localhost/wp_pub/produkt/testproduct/

    When I disable Avatar Privacy, they do not get generated any longer.
    I used the “Identicon” avatar setting. The page with the avatars generating the errors is a woocommerce single product page with avatars at the reviews (comments).

Viewing 11 replies - 16 through 26 (of 26 total)
  • Plugin Author pepe

    (@pputzer)

    OK, that turned out to be pretty simple. The calling code is in the “Recent Reviews” dashboard widget provided by WooCommerce:

    echo get_avatar( $comment->comment_author, '32' );

    $comment->comment_author is the (user visible) name of the comment author. Unfortunately, the get_avatar() function (and ultimately Avatar Privacy) does not expect a comment author name for this argument: The $id_or_email parameter is defined as “Accepts a user_id, gravatar md5 hash, user email, WP_User object, WP_Post object, or WP_Comment object”.

    This is a WooCommerce bug and I’ll file a report in their GitHub repo.

    Plugin Author pepe

    (@pputzer)

    Thread Starter dartrax

    (@dartrax)

    Great! Thanks for finding that out! And sorry for the SSO for Flarum confusion!

    Plugin Author pepe

    (@pputzer)

    MHm. Though it does not look like the WooCommerce bug is the cause of the missing table name. That I cannot reproduce. Is this a multisite installation?

    Thread Starter dartrax

    (@dartrax)

    No, it’s not. Currently it’s a single local XAMPP installation.
    Maybe the Flarum part is required to reproduce? When I tried to track this down I had the feeling that I need all three plugins (Avatar privacy, Woocommerce, SSO for Flarum). Deactivating one and the notice is gone. But I can be wrong.

    Plugin Author pepe

    (@pputzer)

    I’ve tried with WooCommerce and SSO for Flarum (but without the actual Flarum installation). Can you try to reproduce it with just the three plugins and a stock theme (Twenty Twenty or StoreFront)?

    Plugin Author pepe

    (@pputzer)

    @dartrax Have you been able to reproduce the issue in a minimal environment?

    Thread Starter dartrax

    (@dartrax)

    I tried once but it was hard because of caching. I will update all components soon (WordPress, Woocommerce, flarum, SSO for Flarum, etc…) and see if that issue is gone. I will let you know.

    Plugin Author pepe

    (@pputzer)

    Any news on this, @dartrax?

    Thread Starter dartrax

    (@dartrax)

    I’ve updated all plugins. As soon as I deactivated SSO for Flarum the PHP notices are gone. Since I do not use that plugin any longer, I don’t think I’ll see them again (if so, I’ll report). Therefore, we may close this issue.

    Plugin Author pepe

    (@pputzer)

    Thank you for the feedback. I’d have liked to get to the bottom of this, but if it doesn’t happen again, that’s OK too 😉

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘php notice: SQL Syntax Error’ is closed to new replies.