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

Money values of '0' give an assertion error in decimal formats #655

Closed
Venorcis opened this issue Jun 16, 2021 · 1 comment · Fixed by #662
Closed

Money values of '0' give an assertion error in decimal formats #655

Venorcis opened this issue Jun 16, 2021 · 1 comment · Fixed by #662

Comments

@Venorcis
Copy link

Venorcis commented Jun 16, 2021

assert(! empty($formatted));

I believe this empty check is incorrect, because it will trigger an AssertionError on the string '0', which could be a perfectly fine result (e.g. in Polish decimal localisation). I'd suggest removing these assertions altogether; they occur in multiple formatters!

@UlrichEckhardt
Copy link
Contributor

PHP at its finest again:

php > var_dump(empty('0'));
bool(true)

Should that be assert($formatted !== ''); instead?

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 a pull request may close this issue.

2 participants