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

Remove locale from format string to prevent formatting error #644

Merged
merged 2 commits into from
Sep 28, 2018

Conversation

deekthesqueak
Copy link
Contributor

This is:

- [x] a bugfix

Checklist:

Why this change is needed?

When a formatting string has a locale in it an error can occur when outputting. For example when the format string with a locale such as [$-1010409]#,##0.00;-#,##0.00 appears, a value of 9.98 comes back as $9.98. This is because at https://github.com/PHPOffice/PhpSpreadsheet/blob/1.4.0/src/PhpSpreadsheet/Style/NumberFormat.php#L711 the numberFormat regex will match to the zeros inside the locale ([$-1010409]). Attempts to adjust the numberFormat regex caused regressions in other tests. Adding another step to filter out the locale caused no regression.

@PowerKiKi PowerKiKi merged commit 01501b6 into PHPOffice:develop Sep 28, 2018
@PowerKiKi
Copy link
Member

Thanks !

@deekthesqueak deekthesqueak deleted the LocaleFormatBug branch October 7, 2018 07:08
Dfred pushed a commit to Dfred/PhpSpreadsheet that referenced this pull request Nov 20, 2018
…ce#644)

When a formatting string has a locale in it an error can occur when outputting. For example when the format string with a locale such as `[$-1010409]#,##0.00;-#,##0.00` appears, a value of 9.98 comes back as $9.98. This is because at https://github.com/PHPOffice/PhpSpreadsheet/blob/1.4.0/src/PhpSpreadsheet/Style/NumberFormat.php#L711 the numberFormat regex will match to the zeros inside the locale ([$-1010409]). Attempts to adjust the numberFormat regex caused regressions in other tests. Adding another step to filter out the locale caused no regression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants