Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,237
    Plugin Contributions
    20

    Default Double-quotes in metatag fields being converted to htrml entities

    Following notification by a client, we tested this on a vanilla 155a - Trustwave Security Report Patch has been included on the installation

    When entering quote characters in metatag descriptions and titles, the symbol is converted from eg. " to " at the point of saving to the database, yet shows correctly at the point of preview.

    (NB. The usage is to represent inches)
    Development Manager @ JSWeb Ltd
    Over 15 years with Zencart

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Double-quotes in metatag fields being converted to htrml entities

    Um ... You can't use double-quotes in metatags (when the field is bounded by double quotes already). You can't even "escape" them to make them allowed. The HTML spec doesn't allow nesting of quotes within quotes or double-quotes-within-double-quotes.

    Zen Cart has always stripped double-quotes from all title/keyword/description metatags, upon output. So the fact that you're suddenly seeing the conversion to entities admin-side is a secondary observation.

    While the HTML spec allows for <title> to contain quotes/doublequotes, you would need to change every place in the meta_tags.php module file where double-quotes are converted, as well as the html_header where the metatag is rendered, so that it is bounded with single quotes instead of double quotes ... despite the fact that double-quotes are the preferred punctuation generally speaking.

    Only after you've made those significant changes would it make any sense to alter how the Admin handles sanitization of inputs regarding those characters. That said, we'll investigate the ramifications of allowing for the admin to bypass converting those to entities. (See the next post)

    QUESTION:
    Are you *really* wanting ALL three fields (title, description, keywords) to display "inches" symbol? Or is this really just related to setting a custom title?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Double-quotes in metatag fields being converted to htrml entities

    wilt has prepared an update to the admin side that will help bypass the conversion to entities: https://github.com/zencart/zencart/pull/1009/files

    Things to note:
    a) these code changes are based on the latest updates to the Admin sanitization code posted on github, which were updated since the Trustwave announcement was posted

    b) you will still need to edit your html_header.php to bound all your metatags using single-quotes instead of double

    c) you will also need to change all the str_replace('"', '', $foo) in meta_tags.php to replace single-quotes instead of double-quotes

    d) and maybe zen_clean_html() might require customization.

    And then do aggressive testing to ensure you haven't opened up any holes.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,237
    Plugin Contributions
    20

    Default Re: Double-quotes in metatag fields being converted to htrml entities

    Thanks for all that - this should hopefully persuade the client to use ins and ft instead of " and '

    And in answer to your question about all 3 fields - in spite of advice, customers often know best ;-)
    Development Manager @ JSWeb Ltd
    Over 15 years with Zencart

 

 

Similar Threads

  1. v151 Ampersands Not Being Converted
    By Feznizzle in forum General Questions
    Replies: 11
    Last Post: 6 Feb 2016, 04:37 PM
  2. v151 Add double quotes to search results
    By Marco Serge in forum General Questions
    Replies: 1
    Last Post: 4 Dec 2014, 04:24 PM
  3. v151 Manufacters names in dropdown menus being html converted.
    By llynix in forum Bug Reports
    Replies: 5
    Last Post: 26 Dec 2013, 06:21 PM
  4. Replies: 1
    Last Post: 19 Sep 2012, 03:31 AM
  5. Austpost Improved - quotes double the correct price
    By Blueeyedfrog in forum Addon Shipping Modules
    Replies: 4
    Last Post: 4 Apr 2008, 01:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR