Skip to content

Adding incorrect language causes exception in Edit Currency page.  #21891

Closed
@JevgenijVisockij

Description

@JevgenijVisockij
Contributor

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

  1. Add incorrect language for example ISO Code = aa Language Code = en-TS
  2. 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

hibatallahAouadni commented on Nov 12, 2020

@hibatallahAouadni
Contributor

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!

added
1.7.7.0Affects versions
1.7.8.0Affects versions
BugType: Bug
BOCategory: Back Office
CurrenciesLabel: Which BO under menu is concerned
InternationalComponent: Which BO section is concerned
LanguagesLabel: Which BO under menu is concerned
MajorSeverity: major bug > https://build.prestashop.com/news/severity-classification
ReadyStatus: Issue is ready to be worked on
and removed
1.7.8.0Affects versions
on Nov 12, 2020
added
Nice-to-haveKanban prioritization: issue could be included in next version
on Nov 12, 2020
self-assigned this
on Nov 13, 2020

1 remaining item

added
WIPStatus: Work In Progress
and removed
ReadyStatus: Issue is ready to be worked on
on Nov 16, 2020
added this to the 1.7.7.0 milestone on Nov 18, 2020
modified the milestones: 1.7.7.0, 1.7.7.1 on Nov 18, 2020
added
PR availableSolution: issue is being addressed
and removed
WIPStatus: Work In Progress
on Nov 19, 2020
added
Must-haveKanban prioritization: issue must be included in next version
and removed
Nice-to-haveKanban prioritization: issue could be included in next version
on Dec 14, 2020
added
FixedResolution: issue closed because fixed
and removed
WIPStatus: Work In Progress
on Dec 15, 2020
Progi1984

Progi1984 commented on Dec 15, 2020

@Progi1984
Member

Fixed by #21912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

1.7.7.0Affects versionsBOCategory: Back OfficeBugType: BugCurrenciesLabel: Which BO under menu is concernedFixedResolution: issue closed because fixedInternationalComponent: Which BO section is concernedLanguagesLabel: Which BO under menu is concernedMajorSeverity: major bug > https://build.prestashop.com/news/severity-classificationMust-haveKanban prioritization: issue must be included in next versionPR availableSolution: issue is being addressedRegressionType: regressiondevelopBranch

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @eternoendless@Progi1984@atomiix@marionf@khouloudbelguith

    Issue actions

      Adding incorrect language causes exception in Edit Currency page. · Issue #21891 · PrestaShop/PrestaShop