Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,681
    Plugin Contributions
    123

    Default zen_output_string_protected calls on attribute values with inches character (")

    On pages that use zen_output_string_protected() to display attribute values such as the admin orders page and the checkout confirmation page, values that contain the " sign are shown as "

    One possible fix would be to do a replace in zen_output_string before calling htmlspecialchars in includes/functions/functions_general.php

    Code:
      function zen_output_string($string, $translate = false, $protected = false) {
        if ($protected == true) {
          $string = str_replace(""", '"', $string);
          return htmlspecialchars($string, ENT_COMPAT, CHARSET, TRUE);
        } else {
        ...
    Thoughts?
    Last edited by swguy; 20 Apr 2018 at 01:46 AM.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,474
    Plugin Contributions
    88

    Default Re: zen_output_string_protected calls on attribute values with inches character (")

    I've seen it too, as reported here: https://www.zen-cart.com/showthread....-inconsistency

    I'm still not sure what the best solution is; hoping that DrByte will share his opinion!

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: zen_output_string_protected calls on attribute values with inches character (")

    Two years ago there was effort put in to align the two as can be seen here in github related to issue #270

    I seem to recall somewhere either in code review or the discussion being told that a different path was being taken to resolve the issue of concern and that the changes would not be necessary. The admin side had been reworked to both align the protected functions and to eliminate a function that was being sought to be removed. From there expected to correct the issues here or there that are described above, but...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,681
    Plugin Contributions
    123

    Default Re: zen_output_string_protected calls on attribute values with inches character (")

    Perhaps we could start with the question: should this be fixed on the admin side where the data is entered, and captured as &quot; or on the display side (both admin and catalog)? I have no strong feelings - open to proposals.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,681
    Plugin Contributions
    123

    Default Re: zen_output_string_protected calls on attribute values with inches character (")

    Easy repro strategy for anyone who wants to play along:

    Using the demo dataset, modify option 13 to say '3.25 " disk'

    admin/options_values_manager.php?action=update_option_value&value_id=13&value_page=7

    then add a product 22 to your cart:
    index.php?main_page=product_info&products_id=22

    You will not see the issue on the shopping cart page, but you will see it on the checkout confirmation page, and if you complete the order, you'll see it in admin/orders/display that order.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: zen_output_string_protected calls on attribute values with inches character (")

    Quote Originally Posted by swguy View Post
    Perhaps we could start with the question: should this be fixed on the admin side where the data is entered, and captured as &quot; or on the display side (both admin and catalog)? I have no strong feelings - open to proposals.
    From a "final" state perspective, I'd rather see both the catalog and admin sides use the same code as they are both accessing the same source and in general doing the same thing (displaying the data). A process was implemented to store the data in the database using sanitization and that sanitization was not dependent on the zen_output_string_protected function. It also was not necessarily developed with the zen_output_string_protected function results in mind. (making a little bit of a leap there as not privy to other core discussions.)

    The issue I see though is that such a significant modification would also have an impact on other's code and compatibility. (those code counting on the existing function name would respond differently on one side or the other.) a possible solution to that is to either create two new functions or one that is shared between the two sides and make the modifications to support that function map. Something like that was done with the product information in ZC 1.5.5.

    As to the affected characters, anything that is converted is at risk of being displayed as an html entity instead of looking like the desired text: <, >, &, and " all come to mind.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Aug 2013
    Location
    Perth, WA, AU
    Posts
    171
    Plugin Contributions
    3

    Default Re: zen_output_string_protected calls on attribute values with inches character (")

    Quote Originally Posted by mc12345678 View Post
    From a "final" state perspective, I'd rather see both the catalog and admin sides use the same code as they are both accessing the same source and in general doing the same thing (displaying the data). A process was implemented to store the data in the database using sanitization and that sanitization was not dependent on the zen_output_string_protected function. It also was not necessarily developed with the zen_output_string_protected function results in mind. (making a little bit of a leap there as not privy to other core discussions.)

    The issue I see though is that such a significant modification would also have an impact on other's code and compatibility. (those code counting on the existing function name would respond differently on one side or the other.) a possible solution to that is to either create two new functions or one that is shared between the two sides and make the modifications to support that function map. Something like that was done with the product information in ZC 1.5.5.

    As to the affected characters, anything that is converted is at risk of being displayed as an html entity instead of looking like the desired text: <, >, &, and " all come to mind.
    Apologies if there is another thread on this, but was this issue ever sorted?

    My 156c installation is having issues with all 4 of these characters as described.

  8. #8
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: zen_output_string_protected calls on attribute values with inches character (")

    Quote Originally Posted by royaldave View Post
    Apologies if there is another thread on this, but was this issue ever sorted?

    My 156c installation is having issues with all 4 of these characters as described.
    There is an open issue in github on this that is still up-for-grabs for solution: https://github.com/zencart/zencart/issues/2677

    The issue centers around the use of zen_output_string_protected in the tpl_checkout_confirmation_default.php page which causes that change in display. When displaying the information on the shopping cart page, that function is not used and the code has been this way since at least 1.5.0...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Replies: 3
    Last Post: 5 Apr 2013, 01:58 PM
  2. Replies: 8
    Last Post: 23 Jun 2010, 10:12 PM
  3. special character problem - otion values
    By billharris in forum General Questions
    Replies: 4
    Last Post: 22 Dec 2008, 03:27 AM
  4. Metatags stripping the inches (") character?
    By StrictlyAutoParts in forum Basic Configuration
    Replies: 0
    Last Post: 1 Aug 2008, 04:53 PM

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