Description
Describe the bug
Adding incorrect language causes "Cache key length must be greater than zero." error when trying to edit currency. Now I don't know if PrestaShop should implement safeguards against incorrect language or how often and why user would add an incorrect language. But in this case error was rather confusing and I thought something wrong with my cache.
In this case function LocaleRepository->getLocale receives empty $localeCode(i guess at some point PrestaShop fails to find localeCode for incorrect language and simply sends empty localeCode to this function). I would suggest to thorw an Exception here in case localeCode is empty, since exception will be thrown anyway once PrestaShop tries to find empty localeCode in locale cache.
Expected behavior
Incorrect language either shouldn't impact PrestaShop in anyway or Exception should be very clear with what went wrong.
Steps to Reproduce
- Add incorrect language for example ISO Code = aa Language Code = en-TS
- Try to edit currency, receive error "Cache key length must be greater than zero."
Screenshots
If applicable, add screenshots or screen recordings to help explain your problem.
Additional information
- PrestaShop version: develop(1.7.8).
- PHP version: 7.2
Activity
hibatallahAouadni commentedon Nov 12, 2020
Hello @JevgenijVisockij
I managed to reproduce your issue with PS1.7.7.0-rc.1+build.4 and PS1.7.8.0
See the attached screen record below:
https://drive.google.com/file/d/11gXq9dsEWCkHb7H2KcqANida9gifx-B-/view
It's a regression cause I didn't manage to reproduce it with PS1.7.6.8
Thanks for report!
1 remaining item
Progi1984 commentedon Dec 15, 2020
Fixed by #21912