[BUGFIX] Get current locale without changing environment
Two tests in ext:form change the environment when they try to back up the current locale: setlocale(LC_NUMERIC, null): "the locale names will be set from the values of environment variables", should be setlocale(LC_NUMERIC, 0): "the locale setting is not affected, only the current setting is returned" In my case my default LC_NUMERIC is "C" and after call with 'null' it is set to and returns 'de_DE.utf8', so it changes the internal state to something else than before and the reset from backup does not work properly. This leads to hard to debug problems if other locale depending tests are executed later. As a fun fact, phpunit suffers from the same issue and its api method "setlocale()" that should take care of proper reset messes this up, too. A pull request is pending to fix that. The patch fixes the affected unit tests and cleans them up along the way. Another patch to improve the overall situation regarding locale handling in unit tests will follow later. Change-Id: I2295b46cc6934a48e4d71ef5170deb83fb9264b6 Resolves: #76389 Releases: master Reviewed-on: https://review.typo3.org/48416 Reviewed-by:Markus Klein <markus.klein@typo3.org> Tested-by:
Markus Klein <markus.klein@typo3.org> Reviewed-by:
Morton Jonuschat <m.jonuschat@mojocode.de> Tested-by:
Morton Jonuschat <m.jonuschat@mojocode.de>
Showing
- typo3/sysext/form/Tests/Unit/Validator/FloatValidatorTest.php 17 additions, 10 deletions...3/sysext/form/Tests/Unit/Validator/FloatValidatorTest.php
- typo3/sysext/form/Tests/Unit/Validator/IntegerValidatorTest.php 34 additions, 24 deletions...sysext/form/Tests/Unit/Validator/IntegerValidatorTest.php
Please register or sign in to comment