Results 1 to 10 of 14

Threaded View

  1. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,870
    Plugin Contributions
    96

    Default Re: PHP question on /includes/templates/mytemplate/templates/tpl_product_info_display

    Quote Originally Posted by RodG View Post
    Yes, I am aware that there is a subtle difference between == and ===

    Just curious, it a known fact about 'unwanted consequences' , or is it the same disclaimer that I probably should have made on the basis that it probably hasn't been tested in every possible case?

    Fact or not, I agree, it doesn't make sense take the risk of retroactively changing all legacy code due to the current recommendations.

    I do like the idea of making PHP a little more strict though, and for new code, the === is less likely to have unwanted consequences than the ==, and generally speaking, if I AM working on legacy code and come across the odd == I tend to automatically change it to the === and test that nothing got busted as a result (so far, I haven't busted anything by doing this), hence my curiosity as to whether the 'unwanted consequences' are real, or just something that is theoretically possible.

    "I don't know either" is a perfectly acceptable answer. :-)

    Cheers
    Rod.
    As mc12345678 replied, there are places within Zen Cart (and especially the plugins!) where configuration values are checked as
    Code:
    if (CONFIGURATION_VALUE_CONSTANT == 0) {
    }
    which works just fine. The construct
    Code:
    if (CONFIGURATION_VALUE_CONSTANT === 0) {
    }
    will never evaluate to true, since configuration constants are strings, requiring the exactly-equal-to code to be formatted as
    Code:
    if (CONFIGURATION_VALUE_CONSTANT === '0') {
    }
    Last edited by lat9; 13 May 2015 at 09:10 PM. Reason: Corrected misspelling

 

 

Similar Threads

  1. v151 Question regarding $manufacturers_id in tpl_product_info_display.php
    By shirster in forum General Questions
    Replies: 2
    Last Post: 9 Jul 2013, 04:59 AM
  2. Problems with includes/config.php and admin/includes.php
    By Scott83 in forum Basic Configuration
    Replies: 2
    Last Post: 23 Oct 2009, 07:09 PM
  3. PhP question about a line of code in includes/classes/order.php
    By dbrewster in forum Managing Customers and Orders
    Replies: 12
    Last Post: 1 Feb 2007, 03:30 PM

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