If this is your first visit, check our documentation. To post, register or login.
Forums / Code Collaboration / Finding duplicated constants

Finding duplicated constants

Started by torvista on 16 Jun 2019, 8:16 AM · Views: 13,841

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

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
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

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

16 Jun 2019, 11:02 AM
#2
swguy avatar

swguy

Administrator

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

Re: Finding duplicated constants

No, and stop calling me Shirley.

That Software Guy. My Store: Zen Cart Support
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.

16 Jun 2019, 6:36 PM
#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.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

17 Jun 2019, 1:54 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
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

That Software Guy. My Store: Zen Cart Support
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.