Skip to:
Content
Pages
Categories
Search
Top
Bottom

Slashes being added in front of apostrophes

  • bbPress is adding slashes to edited posts in front of all apostrophes – why? How to fix.

    The interesting thing is the number of slashes grows with each edit. So if the post is edited three times, there are three slashes in front of all the apostrophes.

Viewing 25 replies - 1 through 25 (of 37 total)
  • Let’s see if that’s true on this server.

    EDIT: nope. Perhaps it’s a PHP magic quotes issue. I’m surprised this does not happen for new posts, though.

    larmir,

    I had a similar thing happen to me on WordPress. Just about went nuts trying to figure it out, but I finally did. I would think that since bbpress is made by the same folks who did WordPress that you’re experiencing the same thing I did with WordPress. I’m guessing that when you created your database that you didn’t create it in UTF-8 format. If you check the installation documentation, see if it recommends UTF-8. Then, check to see what kind of encoding is on your database. If that is the problem, you can solve the problem fairly easily. Here’s a link to instructions that I wrote for fixing the problem in WordPress:

    http://www.minc.info/?p=32

    You should be able to do the same thing to fix it with bbpress. *NOTE* I haven’t tried this with bbpress so I can’t guarantee it will work.

    Hope that helps,

    Ben

    Trying to re-up this post to find solution. Thanks ben-h, will see what I can find out on the db config.

    On futher review, this IS happening on new posts. Any idea where to turn – other than the db?

    My database is UTF-8. I also have the same database shares tables with WordPress and BBPress. WordPress does not have this problem. Though it happens with all apostrophes and quotation marks on BBPress – new posts and edits. With edits, it will keep adding slashes each time a post/thread is edited.

    Any ideas where to look? I’d really like to get this solved.

    BTW, what is the ‘PHP magic quotes issue?’

    Anyone have any other ideas? This slash thing is driving us crazy…

    I’m still having the problem. Can anyone help?

    If it is the ‘php magic quotes issue’ can someone let me know what to look at to fix it?


    so1o
    Participant

    @so1o

    What database are you using and what is collation?

    mysql on DreamHost. Don’t know what you mean by collation.

    I’d really like to know how to fix this.


    chrishajer
    Participant

    @chrishajer

    larmir, do you have an example URL where we can register and test this out? Also, does Dreamhost have a phpinfo() where we could see about magic_quotes_gpc and magic_quotes_runtime? If they do not have that file, can you create a file on your server called info.php or phpinfo.php (name does not matter so long as you know it) and then, in that file, put this:

    <?php

    phpinfo();

    ?>

    That will give all sorts of useful information, including your magic_quotes settings.

    Thanks.

    Did this. Here’s my magic_quotes settings…

    magic_quotes_gpc Off Off

    magic_quotes_runtime Off Off

    magic_quotes_sybase Off Off

    This any help?


    chrishajer
    Participant

    @chrishajer

    That’s different from my install, my magic_quotes_gpc are “on” and “on”. Now to find out how to get around that for your server…

    What version of PHP are you using? That phpinfo() will tell you, or from the command line, I think php -v

    Also, do you have the ability to use a .htaccess file?

    PHP Version 5.1.2

    Yes, I have the ability to use .htaccess. Though I don’t no much about its parameters. I’ve used it for 301 redirects and that’s about it. Help with writing anything for the .htaccess would be greatly appreciated.

    One bit, I have WordPress on the same server using the same database (bbPress is integrated) and this is NOT an issue in WP – only in bbPress.


    chrishajer
    Participant

    @chrishajer

    I have bbpress and wp on the same database too, and I don’t have a problem with either one. Looking into the gpc_magic_quotes or where addslashes and stripslashes are used.

    What type of quotes are added, single or double?

    Also, do you have a URL where this can be experienced? Looking through the code, there are a lot of slash-things in there. I would like to narrow the problem down by first seeing it. Thanks.

    I’m getting slashes added to apostrophes and quotes.

    I’d like to give you a URL, but can I do so through email? The forum is private and so I don’t want to publish its URL here.

    Here’s my email address dawudmiracle TA gmail TOD com. If you could send me yours, I will forward you a link. Sorry for wanting to remain private – I’m not the only one using our forum and I’d like to be sure its privacy isn’t compromised.

    Thanks for continuing to help.

    MODERATED: obfuscated email address

    Did you find the source of the problem? Even better, did you find a solution? :)

    No, we haven’t. Chrishajer’s (Chris) been graciously helping me off the forum since I’m working with a private forum. He’s spent quite a bit of time on this and hasn’t found a solution. He had some great ideas, they just didn’t work. My next step is to contact my host and talk with them. They host WordPress so perhaps they know something indepth about bbPress. If I find a solution, I’ll let you know.

    I do want to thank Chris for all the time and effort he’s put into this for me. Thank you, Chris.

    Glad to hear someone else is having the same problem as me… misery loves company, right?!? I have found one thing that may be helpful. When I removed the:

    require_once( ‘/…/wp-config.php’);

    define(‘WP_BB’, ‘true’);

    The problem magically vanishes… So, I’m pretty sure it has something to do with the WP integration. Interestingly, I checked my phpinfo and my magic_quotes are all off as well and my php version is 4.4.4.

    My forums are at: http://www.digitalfrontierplus.com/wordpress/forums/

    I can add one more sample of these symptoms.

    The only oddity I’ve been able to find through phpinfo is that it reports the mysql Client API version as 3.23.58, which I find odd as I have mysql 4.1.x on the (linux) server. magic_quotes are off. This is with php 4.3.10, WP 2.1, bbP .75

    ‘ and ” each show up with a single backslash in front of them, but if I put a backslash in the text in front of ‘ or ” it yields 3 backslashes and the ‘/” I don’t know if this double backslash is expected or if it might help find the problem.

    Thanks for helping to track this down.

    Easy fix (hack) in bb-includes/template-functions.php, update this function to look like this:

    function get_post_text() {

    global $bb_post;

    return stripslashes($bb_post->post_text);

    }

    May be an artifact of the wordpress integration – not sure.

    This seems to work for the text. Thanks so much baptiste.

    One more question, the issue still exists in the title. I’m guessing I need to update this expression, just unsure of the syntax:

    function get_topic_title( $id = 0 ) {

    global $topic;

    if ( $id )

    $topic = get_topic( $id );

    return apply_filters( 'get_topic_title', $topic->topic_title, $id );

    }

    Heck yeah! Baptiste kicks Mucho Asso!

    return stripslashes(apply_filters( 'get_topic_title', $topic->topic_title, $id ));

    I’m 90% sure this is related to the kses issue I’m looking into because kses has a strip slashes filter that I think is being used as well, but not 100% sure. The fact that it only happens on WP integration makes me pretty sure it’s kses.

    baptiste – thank you. This worked like a charm. Problem resolved and I can’t thank you enough.

    thanks baptiste!

    The fix worked wonders :)

Viewing 25 replies - 1 through 25 (of 37 total)
  • You must be logged in to reply to this topic.
Skip to toolbar