-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
PHP8 breaks Writer/Xlsx/LocaleFloatsTest; Probably Not Fixable #1663
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Undoing stalebot. |
My initial tests had been with a Release Candidate version of PHP8. Current testing suggests that var_dump has changed since then to produce locale-aware output, which would mean that no changes are required to unit tests. I don't see anything in the change logs which suggest that this behavior has been changed, so I will leave the issue open for now and continue to monitor. The affected test is skipped in the PhpUnit tests on GitHub, because trying to set the locale fails, presumably because only one locale is installed on the test system (or, at least, fr_FR.UTF-8 isn't available). This appears to be the case for all PHP releases which are part of the unit test, not just 8.0/8.1. This isn't ideal; I don't know what can be done to change that. The tests are executed on my local systems. |
And, in an interesting development, it turns out that var_dump is locale-aware in 64-bit PHP8, but not in 32-bit PHP8. I would report the discrepancy, but, if they decided they should act the same, I am not sure whether they would adopt the 64-bit approach for both, or the 32-bit. So I'm going to let this sleeping dog lie. The test could be changed to be skipped on 32-bit PHP8+; for now, that seems premature. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
As mentioned above, this remains an issue in 32-bit PHP8. It also might be an issue for 8.1 regardless of word size. |
The "resolution" in #2231 is probably as good as this will get, so I am closing this issue.
|
This is:
What is the expected behavior?
Unit test sets locale to France, sets cell to 1.1, and reads contents of cell expecting "1,1".
Test succeeds under PHP7; it fails ("1.1") with PHP8. The PHP RFC authorizing the breaking change is:
https://wiki.php.net/rfc/locale_independent_float_to_string
Quoting from there, "In our opinion, the backward compatibility break won't be very serious in practice ..."
It isn't all that difficult to "fix" the test - skip it for PHP8, or delete it as you probably will have to eventually,
or use sprintf (except that will be testing PHP itself, not PhpSpreadsheet), probably others.
The problem is that, even if the test is changed, users depending on the current behavior will view this as a
PhpSpreadsheet problem.
In North America, I am pretty much insulated from this problem. I cannot guess how seriously it might be seen in Europe.
What is the current behavior?
"1,1" with PHP7, "1.1" with PHP8.
What are the steps to reproduce?
Existing unit test Writer/Xlsx/LocaleFloatsTest.php demonstrates the problem.
Which versions of PhpSpreadsheet and PHP are affected?
PHP8, all versions of PhpSpreadsheet.
The text was updated successfully, but these errors were encountered: