-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes problem with latest versions of ICU library where AmPmMarkers i… #38364
Fixes problem with latest versions of ICU library where AmPmMarkers i… #38364
Conversation
Hi @hostep. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
…s no longer defined for each locale. If that's the case fall back to AmPmMarkersAbbr and if that one doesn't exist, fallback to null. This fixes a second problem where previously we always returned 'null' due to the index being a string instead of an integer. That's also fixed now.
88446a5
to
a9aab20
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
Hello @hostep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fixes look nice for me
Approved
@magento run Functional Tests B2B, WebAPI Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
I don't see why that DevExperience label was added? Because this will cause issues on production environments once the ICU library used by PHP is at the latest version... |
@magento run all tests |
✔️ QA PassedPreconditions:
Manual testing scenario: Builds are failed. Hence, moving this PR to Extended Testing. |
@magento run all tests |
@magento run WebAPI Tests,Unit Tests,Functional Tests EE,Functional Tests CE,Functional Tests B2B,Integration Tests |
@magento run Functional Tests EE,Functional Tests CE,Functional Tests B2B |
@magento run Unit Tests,Integration Tests |
18ffc1d
into
magento:2.4-develop
…s no longer defined for each locale. If that's the case fall back to AmPmMarkersAbbr and if that one doesn't exist, fallback to null. This fixes a second problem where previously we always returned 'null' due to the index being a string instead of an integer. That's also fixed now.
Description (*)
See discussions in #38214
The second commit in this PR is to deal with static test failures where a method can contain at most 100 lines, which we just managed to reach with the change in the first commit.
I think this is quite an important fix, because an update of the ICU library on a server will start crashing the shop on every frontend page that contains a JS calendar widget. So if a Linux operating system decides to upgrade to a different version of ICU, your shop might be in trouble despite no other changes have being made to it. Which could be surprising to the merchant & developers.
Maybe it's worth turning this into a quality patch as every Magento version might run into this issue one day or another.
Here's an example of how this data is defined in ICU:
This PR fixes the problem mentioned in the issue and fixes a second bug that has existed since forever in Magento where we always outputted
null
to theam
&pm
variables that get exposed in the phtml files that use this block. This was due to using['0']
and['1']
instead of[0]
&[1]
After some thinking, I decided to implement a fallback system, where we first try to fetch
AmPmMarkers
. If that doesn't exists, try fetchingAmPmMarkersAbbr
and if that doesn't exists, fallback tonull
.As far as I can see, these
am
andpm
variable assignments aren't used in core Magento, but are send to the calendar.phtml file and can be outputted with<?= $am; ?>
and<?= $pm; ?>
. So that if custom theme needs this info, they can use it.I've added some more locale's to be tested in the unit tests, those will also fail without the fixes proposed here when the ICU library is 74.1 or 74.2
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml
and add this line at the very bottom:<ul><li>am: <?= $am; ?></li><li>pm: <?= $pm; ?></li></ul>
bin/magento config:set general/locale/code lv_LV
bin/magento config:set general/locale/code sv_SE
bin/magento config:set general/locale/code de_AT
The biggest thing to check for is that this page doesn't crash. It will not crash with older versions of the ICU library but will crash without these fixes with ICU 74.1 or 74.2. The output for "de_AT" will also be different when using older versions of the ICU library.
Questions or comments
Contribution checklist (*)