Post by georgekaf » Sat Mar 30, 2019 10:18 pm

I have translation strings leaking between language loading.
I am using vqmod and OC v3.0.3.1

The issue I am currently facing is that translation strings found in files loaded at later times override previous values if the same array keys are found to files.
loader earlier in the queue.

For example, I have changed the value of $_['text_manufacturer'] in the catalog/controller/product/product.php to something slightly different. Now, when the catalog/controller/common/footer.php executes and loads its language file, because the $_['text_manufacturer'] exists there as well, its value is changing to the value found in the footer language file. I have tested this behavior by messing with the loader and changing the translation strings and I have confirmed it is the footer language file that overrides the product language file. I've never encountered this issue before with previous versions.

It has come to my attention that the way the languages strings are loaded to their respective parameters has changed, correct?
I had the impression that each controller was using its own language file, that's why it had the same variable names in multiple files.
Has the scope of each language file loaded changed to being global and not limited to each controller?

This is the language loading queue (first language file loaded is on top). I used debug_backtrace in system/engine/loader.php to extract these.

Code: Select all

en-gb is called in /upload/vqmod/vqcache/vq2-system_framework.php:166
product/product is called in /upload/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php:9
extension/captcha/google is called in /upload/catalog/controller/extension/captcha/google.php:4
common/footer is called in /upload/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_common_footer.php:4
extension/module/isenselabs_gdpr is called in /upload/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_common_footer.php:22
common/header is called in /upload/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_common_header.php:86
common/language is called in /upload/catalog/controller/common/language.php:4
common/currency is called in /upload/catalog/controller/common/currency.php:4
common/search is called in /upload/catalog/controller/common/search.php:4
common/cart is called in /upload/system/storage/modification/catalog/controller/common/cart.php:4
extension/total/sub_total is called in /upload/catalog/model/extension/total/sub_total.php:4
extension/total/total is called in /upload/catalog/model/extension/total/total.php:4
common/menu is called in /upload/catalog/controller/common/menu.php:4
common/language is called in /upload/catalog/controller/common/language.php:4
common/currency is called in /upload/catalog/controller/common/currency.php:4
common/search is called in /upload/catalog/controller/common/search.php:4
common/cart is called in /upload/system/storage/modification/catalog/controller/common/cart.php:4
extension/total/sub_total is called in /upload/catalog/model/extension/total/sub_total.php:4
extension/total/total is called in /upload/catalog/model/extension/total/total.php:4
common/menu is called in /upload/catalog/controller/common/menu.php:4
Is this a bug? Do I need to assign my change to a new key?

New member

Posts

Joined
Fri Jun 17, 2011 10:46 pm

Post by straightlight » Sat Mar 30, 2019 11:48 pm

Not a bug but a data initiation conflict since the catalog product page does load the footer controller in the mean time. Each data keys must then be different as to declare those changes to your language file and your theme file where you are affecting the change. I had this discussion on GitHub recently regarding the theme override modifications since your topic inquiry addresses one of the only problematic that could be created either with or without these modifications unfortunately. This was also addressed on the forum by me prior quite sometime ago regarding error event handlers that should be separated between the core and the extensions that would ease troubleshooting whenever those cases occurs in Opencart.

The best solution is to ensure that no array keys are conflicting with one-and-another when multiple controllers needs to operate together.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by georgekaf » Mon Apr 01, 2019 1:06 pm

Thank you Straightlight.

Indeed there are some theme modifications in place, but nothing that would explain such behavior. A little voice was telling I am not going crazy, I knew it!
Can you paste the forum topics and the github thread ? I'd like to see what is being discussed.

Regrads.

New member

Posts

Joined
Fri Jun 17, 2011 10:46 pm

Post by georgekaf » Thu Jun 13, 2019 8:10 pm

I updated to 3.0.3.2 and the problem resolved itself :laugh:

New member

Posts

Joined
Fri Jun 17, 2011 10:46 pm

Post by straightlight » Thu Jun 13, 2019 9:07 pm

Great, then the issue you reported was reported prior in order to be resolved.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 95 guests