Forums

Apostrophe borking comment submission (5 posts)

  1. dnorman
    Member
    Posted 4 years ago #

    I've got an apostrophe in my name (D'Arcy), and on my weblog I've set up my user with that as the display name etc... I just went to add a comment to my weblog to respond to someone else's comment, and it looked like it was barfing pretty violently on the apostrophe. I took it out of my WP user (Changed firstname and display name to "DArcy"), and all was well...

    I was able to comment successfully with the previous beta, but I just installed the latest gamma (1.5-gamma 2005-02-05) and now get an error.

    Here's the error I got:

    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 'Arcy' AND comment_author_email = 'dlnorman@ucalgary.ca' and com]
    SELECT comment_approved FROM wp_comments WHERE comment_author = 'D'Arcy' AND comment_author_email = 'dlnorman@ucalgary.ca' and comment_approved = '1'

    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 'Arcy', 'dlnorman@ucalgary.ca', 'http://www.darcynorman.net]
    INSERT INTO wp_comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, user_id) VALUES ('547', 'D'Arcy', 'dlnorman@ucalgary.ca', 'http://commons.ucalgary.ca/weblogs/dnorman', 'IP_ADDRESS_REMOVED', '2005-02-05 18:57:32', '2005-02-06 01:57:32', 'testing comment submission', '0', 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/125.5.6 (KHTML, like Gecko) Safari/125.12', '', '2')

  2. Cypher
    Member
    Posted 4 years ago #

    I can see how using your name with the apostrophe will screw up database searches because the single quote character is used to denote strings in those queries.

    With the use of your apostrophe in your name, the string will get prematurely terminated and what's left will not be valid.

    No clue as to a fix though.

    Regards

  3. mdawaffe
    Member
    Posted 4 years ago #

    I was about to suggest you report this a s bug, but it seems you already have
    :)

  4. wghayes
    Member
    Posted 4 years ago #

    Did you try escaping the apostrophe (D\'Arcy) or would that fail in this instance?

  5. dnorman
    Member
    Posted 4 years ago #

    Escaping the apostrophe in my User info for the weblog itself seems to fix it. (name: D\'Arcy ) - I can then use "D'Arcy" as the name in the comment entry form (no escape needed).

    It looks like this is fixed already in the CVS version, at http://wordpress.org/pipermail/cvs/2005-February/001054.html

    Thanks to everyone who helped! Loving wordpress more every day!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.