Skip to content

Noisier warning if JSON_PRESERVE_ZERO_FRACTION not available #3

@sminnee

Description

@sminnee

If JSON_PRESERVE_ZERO_FRACTION isn't defined, then this library converts any whole-number float value to an integer. This can cause some hard-to-find bugs and it would be better if this script complained more loudly.

I think this package should have a check for if(!defined('JSON_PRESERVE_ZERO_FRACTION')) and throw an E_USER_WARNING or exception. It could either do this all the time, or it could do it only if float / whole-number-float values are included in a data payload.

Generally speaking I would advise against using this package if JSON_PRESERVE_ZERO_FRACTION wasn't available. Probably, I would recommend that the user of the package upgrades.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions