Skip to:
Content
Pages
Categories
Search
Top
Bottom

Database error whenever I use an @mention in a forum post!


  • rossagrant
    Participant

    @rossagrant

    I’ve noticed this for a while, and I’m not sure what is causing it.

    Whenever I use an @mention in my forum posts I get a DB error reported in my server’s error log.

    Here is an example:

    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 ‘http://www.mysite.com/members/dave/’ rel=’nofollow’>@cdave is’ at line 1 for query SELECT ID FROM wp_posts WHERE post_type = ‘reply’ AND post_status != ‘trash’ AND post_author = 11 AND post_content = ‘@cdave is this still happening Dave?’ AND post_parent = ‘11990’ LIMIT 1 made by

    Any idea if this is actually my DB or is it BBPress at fault?

    My site title also has an apostrophe in it, and this appears as raw HTML in all notification emails.

    Any idea on these 2 things guys?

Viewing 21 replies - 1 through 21 (of 21 total)

  • rossagrant
    Participant

    @rossagrant

    Just wondering if anyone has had time to check their error log and see if ou get this also?

    Write a forum post with an @mention and see if you get the error reported regarding syntax.

    Cheers!

    I have just been updating the bbPress importers to support mentions eg. @rossagrant over the past few days and have had ~500,000 posts go through the DB and test site and maybe 1% would have a quote or mention, maybe less, it’s still quite a few and I have don’t see any of the SQL errors you @mention.

    Is your site title issue a URL that is displaying like this?
    ‘http://www.mysite.com/members/dave/’
    If so it is because the URL is wrapped in single or double quotes and will be fixed in the next version of bbPress, if not could you give us some more detailed info, what it should be and what it is sending in the email.

    Edit: Ha, I cant force the error in that URL above, does it look like the URL with the ‘& # 8217′ at the end like your first post here in this topic?


    rossagrant
    Participant

    @rossagrant

    Cheers for the update Stephen!

    I’m still getting it, every single time I use an @mention>

    Here’s one I got tonight:

    [19-Jan-2013 00:40:03 UTC] 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 ‘http://www.mysite.com/members/hardylane/’ rel=’nofollow’>@hardylane Trish ‘ at line 1 for query SELECT ID FROM wp_posts WHERE post_type = ‘reply’ AND post_status != ‘trash’ AND post_author = 11 AND post_content = ‘No worries! Say hello to Trish from me!

    @hardylane Trish is still at Man Met isn\’t she Annie? I know Niamh has departed now.’ AND post_parent = ‘12436’ LIMIT 1 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), do_action(‘template_redirect’), call_user_func_array, bbp_template_redirect, do_action(‘bbp_template_redirect’), call_user_func_array, bbp_new_reply_handler, bbp_check_for_duplicate

    Any idea what I may need to change in my DB to stop this?

    With regards to the email being sent out, the SUBJECT appears like this: (apostrophe is output as '

    [My Site - The Actors' Network] Topic Name

    So the apostrophe should appear as The Actors’ Network, but it’s stripped.

    Not sure if the 2 problems are associated?

    Thanks so much for your time!

    :)


    rossagrant
    Participant

    @rossagrant

    Just realised, the reason that you see the &#8217 in the URL is JUST THIS FORUM. It’s obviously stripping the second apostrophe JUST IN THIS FORUM.

    Ignore that, it’s in 2 single quotes in my error log, it’s just because I’ve not posted it as code here.

    I’ll try again here, see if it includes the second single quote.

    `[19-Jan-2013 00:40:03 UTC] 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 ‘http://www.actonthis.tv/members/hardylane/’ rel=’nofollow’>@hardylane Trish ‘ at line 1 for query SELECT ID FROM wp_posts WHERE post_type = ‘reply’ AND post_status != ‘trash’ AND post_author = 11 AND post_content = ‘No worries! Say hello to Trish from me!

    @hardylane Trish is still at Man Met isn\’t she Annie? I know Niamh has departed now.’ AND post_parent = ‘12436’ LIMIT 1 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), do_action(‘template_redirect’), call_user_func_array, bbp_template_redirect, do_action(‘bbp_template_redirect’), call_user_func_array, bbp_new_reply_handler, bbp_check_for_duplicate`

    The URL displays fine in the error log, hopefully it will here now too.


    rossagrant
    Participant

    @rossagrant

    No it doesn’t, but ignore that ’ – it’s tripped for security here.

    Hope that’s not confused stuff?


    rossagrant
    Participant

    @rossagrant

    Bloody hell, now the email subject looks fine above as it HASN’T been output as raw html in this forum.

    The subject in the emails shows the apostrophe as pure html though.

    It’s hard to show here as the forums seem to change html to how it should be displayed.

    So to clarify:

    – In my DB issue with the syntax, that &#8217 DOESN’T show in the error log – JUST IN THE FORUM POST – it shows in the error log as another single quote.

    – The subject line of the bbpress notification emails is outputting the apostrophe as raw html.
    The from address is fine and shows the apostrophe normally. It’s just the subject line that is wrong.

    Phew… thanks!

    I created #2172 and patched the issue of ‘special characters’ in ‘blogname’ for bbPress subscription emails.

    I’m still looking into the @mentions and I cannot reproduce it.

    Do you get this error for every @mention in your forums?


    rossagrant
    Participant

    @rossagrant

    Legendary! Yeah the blogname had that exact issue, so if that patch works, that’s absolutely awesome!

    In terms of the @mentions, I’m going to go through the error log and see if it affects EVERY one of them, or just if it affects certain ones.

    Will update soon!

    Thanks again! :)


    rossagrant
    Participant

    @rossagrant

    Yep, looking at my error log, I get the same error occurring whenever anybody uses an @mention at all.

    Not quite sure what to explore here as a cause.

    Will see if I can recreate on any other installs.

    Ross :)


    rossagrant
    Participant

    @rossagrant

    Hey Stephen,

    I’ve been debugging this for a while and it appears that I don’t get the erro if I post as admi, I only get it if I’m posting as a participant.

    Could you try posting an @mention as a regular participant in the forum and see if you get it?

    No idea why that would affect things, but it does seem to.

    Will keep testing various scenarios!


    rossagrant
    Participant

    @rossagrant

    Did you get a chance to test this @netweb?

    I am only seeing this error when posting as a participant and using an @mention.

    When I post as admin, I don’t get it?

    Any ideas? Can you recreate it?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Seems odd that being a participant would trigger it. @rossagrant, can you try with 2.3 beta 1, and let me know if that fixes anything? We’ve been on trunk here for months with no issues, and we’ve got over 5 million users.


    rossagrant
    Participant

    @rossagrant

    Certainly will JJ, give me 10 minutes!


    rossagrant
    Participant

    @rossagrant

    Haha, sorry for being such a bloody noob JJ, do you have a version packaged up anywhere? I’ve never used SVN before or bleeding edge versions of stuff?

    Is there a regular download link to the latest 2.3 beta?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    No worries. Here you go.


    rossagrant
    Participant

    @rossagrant

    @johnjamesjacoby Cheers JJ. I’ve just tested with bbpress2.3 beta 1 and I still get the same behaviour.

    Admin can use @mentions and no syntax error appears in the error log.

    As soon as a regular participant does, then they get this error:

    `[29-Jan-2013 12:51:38 UTC] 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 ‘http://www.mysite.tv/members/admin/’ rel=’nofollow’>@admin mentio’ at line 1 for query SELECT ID FROM wp_posts WHERE post_type = ‘reply’ AND post_status != ‘trash’ AND post_author = 40 AND post_content = ‘Now testing @admin mention in a forum post.’ AND post_parent = ‘9865’ LIMIT 1 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), do_action(‘template_redirect’), call_user_func_array, bbp_template_redirect, do_action(‘bbp_template_redirect’), call_user_func_array, bbp_post_request, do_action(‘bbp_post_request’), call_user_func_array, bbp_new_reply_handler, bbp_check_for_duplicate`

    Only happens with participants.

    Can you replicate this in your error log at all?


    rossagrant
    Participant

    @rossagrant

    Just to update on testing too, I have fully tested this now and can recreate it on all of my installs and a brand new install of BP 1.6.3, WP 3.5 and BBPress 2.2.4.

    Admin can post @mentions freely, but regular BP members (assigned participant role) can’t without that error in the log appearing.

    The @mention still works as it should but I can’t for the life of me see why it’s throwing that error.

    I’ve tried it and get the same result on 3 separate servers now too. I have tried it with BP-Default and NO plugins except for BP and BBPress.

    If you guys need me to test anything else at all, please shout up.

    Should I create a ticket in TRAC?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Confirmed on my local; it’s only when BuddyPress is active, and I know what’s up. @rossagent, go ahead and open a ticket, and I’ll get this fixed up asap.

    To confirm:

    • BuddyPress must be active
    • Activity streams must be active
    • User must not be an admin/super admin

    rossagrant
    Participant

    @rossagrant

    Nice one JJ,

    ticket is here: http://bbpress.trac.wordpress.org/ticket/2185

    Phew… glad that wasn’t just me going mad!


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Fixed! This changeset specifically is likely the one causing you problems.


    rossagrant
    Participant

    @rossagrant

    Awesome JJ, you were on that like lightning!

    Thanks so much for checking it out!

Viewing 21 replies - 1 through 21 (of 21 total)

You must be logged in to reply to this topic.