
Originally Posted by
RodG
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') {
}