Skip to content
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

Support for PHP >= 8.2 #299

Merged
merged 3 commits into from
Jul 24, 2024
Merged

Conversation

pedro-mendonca
Copy link
Contributor

@pedro-mendonca pedro-mendonca commented Jul 24, 2024

Since PHP 8.2 that ksort() deals with int/string keys differently.
https://php.watch/versions/8.2/ksort-SORT_REGULAR-order-changes

Up to PHP 8.1 the int keys are sorted last.
From PHP 8.2 the int keys are sorted first.

The current .mo test file has the original string 12345 in the end.
This was ok until PHP 8.2.

This PR makes sure that the strings of the generated .mo file are sorted by the original, comparing all keys as strings and outputs the strings with numbers before the ones with letters.

Another string is added to the test to make sure that the original 12345 is sorted before 15 (compared as strings, as it's supposed)

The result of the translations array before output to .mo file is:

  • 12345
  • 15
  • Original
  • Other comment

Fixes #298

@oscarotero oscarotero merged commit 73c501a into php-gettext:master Jul 24, 2024
7 checks passed
@oscarotero
Copy link
Member

It's perfect. Thank so much!

@pedro-mendonca
Copy link
Contributor Author

My pleasure 😃
Thanks for this awesome project!

@pedro-mendonca pedro-mendonca deleted the php-8-3-test branch July 25, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP 8.3 Support
2 participants