• 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: https://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 15 replies - 1 through 15 (of 26 total)
  • Plugin Author pepe

    (@pputzer)

    Hi @dartrax! That’s pretty weird. Is that the unmodified output? Do you really get “hash = ‘testuser1′”? I’m wondering how that’s possible (hash should be a SHA256 hex string). Could you please post more of the error log? There should be other errors before to arrive at such a truncated SQL string.

    Thread Starter dartrax

    (@dartrax)

    Hi @pputzer, thank you for your reply! This is nearly unmodified. I only replaced a customer’s name with testuser1 for privacy reasons. But it’s a clear username, not a hex string. This is one line in error.log. I post more of the error log, I only change the user names:

    [Wed Jul 22 20:07:31.778858 2020] [php7:notice] [pid 20096:tid 1772] [client ::1:55243] 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 = 'Gerhard C.'' at line 1 for query SELECT * FROM  WHERE hash = 'Gerhard C.' 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: https://localhost/wp_pub/produkt/nanocul-433/
    [Wed Jul 22 20:07:31.780853 2020] [php7:notice] [pid 20096:tid 1772] [client ::1:55243] 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 = 'Matthias B.'' at line 1 for query SELECT * FROM  WHERE hash = 'Matthias B.' 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: https://localhost/wp_pub/produkt/nanocul-433/
    [Wed Jul 22 20:07:31.782848 2020] [php7:notice] [pid 20096:tid 1772] [client ::1:55243] 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 = 'maxmuster9586'' at line 1 for query SELECT * FROM  WHERE hash = 'maxmuster9586' 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: https://localhost/wp_pub/produkt/nanocul-433/
    [Wed Jul 22 20:07:31.783845 2020] [php7:notice] [pid 20096:tid 1772] [client ::1:55243] 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: https://localhost/wp_pub/produkt/nanocul-433/

    I think the code is called in woocommerce single-product-reviews.php with those lines:

    <ol class="commentlist">
    	<?php wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ) ); ?>
    </ol>

    Please tell me what else do you need to find out what causes this?

    Plugin Author pepe

    (@pputzer)

    @dartrax Is it possible that these comments do not have an email address set and that woocommerce has set that field to the username instead? Still, there should be a table name in the query unless something goes wrong very early. Can you reproduce the issue in a minimal system?

    Thread Starter dartrax

    (@dartrax)

    Hi @pputzer,
    if I look at the database table comments, where comment_type is review, comment_author_email contains the mail adresses and comment_author the usernames.
    I don’t know if this is important: user_id is equal for all of them, because I created the review-comments manually (via wordpress) and changed the comment_author_email and comment_author after creation (via wordpress). The reason for that is that the customers do not have their own account (guestorder) and I got their reviews by mail.

    Do you need some more database insight?

    If this alone doesn’t help, I will try it tomorrow with unmodified comments by testuser accounts. If that makes a difference, I should be able to explain how to reproduce.

    Plugin Author pepe

    (@pputzer)

    Are you saying that the have a non-zero but invalid user ID attached? That could be part of the problem (anonymous comments normally have 0 as the user ID). Still it’s kind of hard to image having everything fail in exactly this way.

    It would be best if you could try to recreate the issue in a minimal environment (default theme, as few plugins as possible).

    Thread Starter dartrax

    (@dartrax)

    No, user ID is 1, that is admin ID. Admin created those comments and changed the comment_author_email and comment_author after creation (via wordpress).

    I’ll try that, I hope to find the time for that on Sunday.

    Plugin Author pepe

    (@pputzer)

    Any luck?

    Thread Starter dartrax

    (@dartrax)

    No. I could not reproduce it on another wordpress instance yet. I tried to track it down on the one where the notice appeared by disabling all plugins and enabling one by one. Once I had only woocommerce and Antispam Bee enabled I saw the notice. I wanted to be sure and disabled Antispam Bee again. Since that I was not able to reproduce that any longer, even with Antispam Bee and all other plugins enabled. I don’t know if there is some kind of caching getting in the way now. I’ll have to observe that…

    Edit: Half an hour later, it’s there again…

    • This reply was modified 4 years, 7 months ago by dartrax.
    Thread Starter dartrax

    (@dartrax)

    I think I have tracked it down to this two extensions that, if enabled together, lead to the descripted behavior:

    • Avatar Privacy
    • SSO for Flarum

    I’ll report this to the developer of SSO for Flarum as well. That plugin is in active development and I’m already in contact with him.

    It would be great if there is a way to display the avatars generated by Avatar Privacy in the Flarum Forum as well, but this should be discussed in another thread.

    Plugin Author pepe

    (@pputzer)

    I’ll look into it if you give me a link to the other plugin. I’m very interested what could possibly interfere like this.

    Thread Starter dartrax

    (@dartrax)

    Thread Starter dartrax

    (@dartrax)

    The Author of SSO for Flarum responded, he thinks the bug is in Avatar Privacy code.
    https://bugs.maicol07.it/issue/FSSOE-14#focus=Comments-4-3.0-0

    Plugin Author pepe

    (@pputzer)

    Unfortunately, this looks like an a priori dismissal to me (at least he didn’t include any reasoning why he thinks that, so it does not help me narrow things down).

    Thread Starter dartrax

    (@dartrax)

    I asked for a more detailed guess and got this:

    Well, I don’t use that query in my plugin. I’ll test it in my local environment. I can’t replicate the error.
    I’ve noticed now that the error trace shows where the exception occured: none of that functions are used by the Flarum SSO WP Plugin

    Plugin Author pepe

    (@pputzer)

    @dartrax Sorry for the delay. I’ve tried to reproduce this issue with the two plugins installed, but could not. Can you please try to reproduce this in a minimal environment (fresh WP installation, default theme, just the two plugins)? If you cannot reproduce it in this environment, try to add things one by one until you get the effect described.

    I’ve managed to reproduce the issue after all. SSL-Flarum has got nothing to do with it, it’s something weird with WooCommerce reviews. I’ll investigate.

    • This reply was modified 4 years, 6 months ago by pepe.
Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘php notice: SQL Syntax Error’ is closed to new replies.