Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default zen_output_string inconsistency

    I had a report from a client (running zc1.5.5e) that an attribute's value was rendering as Width: 1" instead of Width: 1" on the storefront display (checkout_success and account_history_info). The double-quote is properly rendered when viewing the order in the admin.

    That value is defined as "1"" by the admin's Catalog->Options Value Manager. When investigating the discrepancy, I found that the admin version of the function zen_output_string (present in /admin/includes/functions/general.php):
    Code:
      function zen_output_string($string, $translate = false, $protected = false) {
        if ($protected == true) {
          return htmlspecialchars($string, ENT_COMPAT, CHARSET, FALSE);
        } else {
          if ($translate == false) {
            return zen_parse_input_field_data($string, array('"' => '"'));
          } else {
            return zen_parse_input_field_data($string, $translate);
          }
        }
      }
    differs from the storefront implementation (present in /includes/functions/functions_general.php):
    Code:
      function zen_output_string($string, $translate = false, $protected = false) {
        if ($protected == true) {
          return htmlspecialchars($string, ENT_COMPAT, CHARSET, TRUE);
        } else {
          if ($translate === false) {
            return zen_parse_input_field_data($string, array('"' => '"'));
          } else {
            return zen_parse_input_field_data($string, $translate);
          }
        }
      }
    My belief is that the admin version is correct, i.e. don't double-encode any pre-existing HTML entities aren't encoded.

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,668
    Plugin Contributions
    11

    Default Re: zen_output_string inconsistency

    we need to stop having the same function defined differently on the admin and on the catalog side. maintenance of these issues is terrible.

    duplicate code => bad.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: zen_output_string inconsistency

    Quote Originally Posted by carlwhat View Post
    we need to stop having the same function defined differently on the admin and on the catalog side. maintenance of these issues is terrible.

    duplicate code => bad.
    Yes it is, and I believe it is being worked on. I know some classes already have been merged, but am not sure on the functions

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: zen_output_string inconsistency

    Quote Originally Posted by carlwhat View Post
    we need to stop having the same function defined differently on the admin and on the catalog side. maintenance of these issues is terrible.

    duplicate code => bad.
    duplicate-code-that's-different => worst

 

 

Similar Threads

  1. v154 Redirect inconsistency
    By yaseent in forum Bug Reports
    Replies: 2
    Last Post: 19 Nov 2015, 06:56 AM
  2. Image inconsistency
    By mrcastle in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 4 Mar 2010, 11:46 AM
  3. RowEven / RowOdd inconsistency
    By dysfunctional in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 30 Sep 2009, 07:42 PM
  4. Got an odd little inconsistency
    By r1formetoo in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 21 Mar 2009, 01:17 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