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

Format decimal points not working correctly #1142

Closed
SylwesterZarebski opened this issue Feb 18, 2019 · 2 comments
Closed

Format decimal points not working correctly #1142

SylwesterZarebski opened this issue Feb 18, 2019 · 2 comments
Labels

Comments

@SylwesterZarebski
Copy link

SylwesterZarebski commented Feb 18, 2019

Last revision of fatfree changes number decimals handling and accidentally broke it.
Culprit is commit #3604f7a in fatfree-core:
https://github.com/bcosca/fatfree-core/blob/master/base.php#L995
which goes to:
https://github.com/bcosca/fatfree/blob/master/lib/base.php#L980

Bug is in:

isset($prop)?
    $prop:
    $frac?strlen($frac)-2:0,

which should be:

isset($prop)?
    $prop:
    ($frac?strlen($frac)-2:0),

Note parentheses around second ternary. You've been hit by PHP's ternary design bug.

PS. Could You make some tests to check for formatting bugs?

ikkez added a commit to f3-factory/fatfree-core that referenced this issue Feb 18, 2019
@ikkez
Copy link
Collaborator

ikkez commented Feb 18, 2019

nice catch. thanks.
ref.: f3-factory/fatfree-core@3604f7a

@SylwesterZarebski
Copy link
Author

Thanks for quick commit 👍 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants