Zen Cart Logo
Forums / Code Collaboration / Finding duplicated constants

Finding duplicated constants

Views: 13,828

Results 1 to 4 of 4
16 Jun 2019, 08:16
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,866
Plugin Contributions:
7

Finding duplicated constants

While nit-picking with Report All Errors, notices for duplicated constants keep cropping up.

Surely by now someone has made a utility script to read the main language file and then scan the others for duplicates....?

I say that in addition to "surely everyone"

  • develops on the most recent version of php to get an early warning heads-up
  • has STRICT enabled
  • uses Report All Errors and a HTML validator before submitting a PR
16 Jun 2019, 11:02
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Finding duplicated constants

No, and stop calling me Shirley.

16 Jun 2019, 18:36
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Finding duplicated constants

Thing is, that unless referring to duplication of a constant within a single file, that so long as Zen Cart continues to use constants for language values (without checking for previous definition) along with the template override system then the existence of duplicate constants is likely to occur.

I believe that this is one reason that a future version of Zen Cart is to use a variable array to contain definitions. Unfortunately assignment of language values in that arrangement requires a reverse assignment of values by first populating the "base" language's definitions, followed by an alternate language's override(s), then a specific file's override with whatever intermediate file overrides are to be considered. The current override is expected to load the current file's definitions before loading the base language.

Both have their "issues" and there would need to be some determined scheme about how to fully handle the overrides as say a core file may have a definition that is desired but is then overridden in a file's override that then has to be overridden again in a language/template override to return back to the original version. Whatever it ends up being, I'm sure there will be an update in guidance either made or needed.

17 Jun 2019, 13:54
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Finding duplicated constants

Speaking of Report All Errors, here's a request to add it to the core:
https://github.com/zencart/zencart/issues/2460