ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

EE adding backslashes to escape quotes on all entries; not magicslashes

May 27, 2011 4:03pm

Subscribe [3]
  • #1 / May 27, 2011 4:03pm

    BioLogos

    11 posts

    Hey there,

    So, we’re in the process of upgrading to EE2, and I’m hitting a problem I can’t seem to pinpoint: EE keeps adding escape slashes to quotes in any entry, but not template. That is, the templates render fine, but their content has escaped slashes.

    This is also true in the control panel (see screenshots), where everything looks fine in the textarea field, but renders with slashes after hitting save. As the screenshots show, any

    "
    quote is escaped, but
    &quo;

    renders as a normal quote. Database tables show the content without slashes, identically to the textarea field, showing that PHP isn’t adding slashes on submit, but rather EE is while rendering. PHP’s magicslashes are turned off, and PHP is not in safemode.

    I searched the forums, but didn’t see anything here, and I’m stumped. Any thoughts?

    Thanks in advance!
    -Mike


    ENVIRONMENT:
    Local dev machine: OSX, PHP5.3, MYSQL5.1
    Installed 3rd party: playa, low_replace, trunchtml
    EE2.1.3


    PS: you may think about increasing the 200kb “total attached files” size cap, which makes it a little difficult to upload more than 1 screenshot. Just a thought!

  • #2 / May 27, 2011 5:27pm

    BioLogos

    11 posts

    Any suggestions?

    I’ve noticed that single quotes aren’t being escaped, but I still have no idea what’s causing this.

  • #3 / May 27, 2011 6:48pm

    BioLogos

    11 posts

    Bump

  • #4 / May 29, 2011 9:43am

    Greg Salt

    3988 posts

    Hi BioLogos,

    Welcome to the forums!

    This is a bit odd. Are quotes escaped on new entries as well? It looks rather like this quoting is somehow appearing because of the inline styles in that entry. Can you please try removing all those inline styles on one of the problematic entries?

    For reference please have a look at our Support Policy - we use a queuing system for Technical Support bumping your posts may make it seem as if your post has been answered or replied to.

    Cheers

    Greg

  • #5 / May 31, 2011 3:31pm

    BioLogos

    11 posts

    Hi Greg! Thanks for the reply, and clarification about the support process.

    As far as the issue goes, it appears to apply to any ” quote, whether or not it is part of inline styling. Also, it applies to both new and old entries.

    When a new entry is created with the following in any field (such as description or full text):

    <a href="http://www.google.com/images/logos/ps_logo2.png">http://www.google.com/images/logos/ps_logo2.png</a>
    
    <b>This is a test</b>
    
    Normal quote: " 
    
    HTML quote: &quo;
    

    it outputs the following in both the control panel, and the front end:

    <img  >
    
    
    <b>This is a test</b>
    
    Normal quote: \" 
    
    HTML quote: &quo;
    

    This is such strange behavior…

    Thanks again for the help,
    Mike

  • #6 / May 31, 2011 3:49pm

    Brandon Jones

    5500 posts

    Hi Mike,

    Are you using MAMP? If so, try upgrading to the latest version. If not, I’d suggest giving it a try as it will provide a second environment to test on, which should help narrow down the culprit.

  • #7 / May 31, 2011 4:45pm

    BioLogos

    11 posts

    I am running mac, apache, mysql, and php, but from natively compiled mysql and php, and the included apache (which are all up to date) and not the pre-packaged MAMP.

    I’m not sure it would be the environment, because I have another dev copy of our site running EE1.6 without problem. Also, MYSQL seems to be feeding everything to PHP perfectly fine:

    In a test template, I write:

    {exp:query sql="SELECT field_id_44 FROM exp_channel_data WHERE entry_id=2257"}
    
    {field_id_44}
    
    {/exp:query}
    
    
    {exp:channel:entries show_future_entries="yes" dynamic="off" entry_id="2257"}
    
    {blurb}
    
    {/exp:channel:entries}


    Which outputs:

    <a href="http://www.google.com/images/logos/ps_logo2.png">http://www.google.com/images/logos/ps_logo2.png</a>
    
    <b>This is a test</b>
    
    Normal quote: " 
    
    HTML quote: "
    
    
    
    
    
    
    
    <img  >
    
    <b>This is a test</b>
    
    Normal quote: \" 
    
    HTML quote: "
    
  • #8 / May 31, 2011 4:48pm

    BioLogos

    11 posts

    One quick note, on both of my posts above, the forum’s [ code ] tag is stripping the url from the erroneous image tag, which should in fact be:

    < img src= \ “http://www.google.com/images/logos/ps_logo2.png \ ” >

    instead of blank.

  • #9 / May 31, 2011 6:21pm

    BioLogos

    11 posts

    Hi again; just fixed it, and thought I’d post the solution here in case someone else has this problem (great call on having all your support take place in a public forum!).

    By going through the ‘parse_type’ function in /system/expressionengine/libraries/EE_Typography.php, I was able to track the problem to the word censoring section. When I turned word censoring OFF in the control panel, and re-enabled it, the problem vanished! I’m not exactly sure what was going on behind the scenes, but I assume something in the migration never completely updated.

    So, the solution: Turn word censoring OFF, then back ON.

    Thanks for your help and input,
    Mike

  • #10 / Jun 01, 2011 2:24pm

    Kevin Smith

    4784 posts

    Mike, glad to see you tracked the problem down. And double thanks for posting the solution back here to help others!

    Feel free to join us back here if you have any other issues arise.

    Kevin

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases