Json::encode - pass all options to json_encode#89
Json::encode - pass all options to json_encode#89ondrejmirtes wants to merge 1 commit intonette:masterfrom
Conversation
1430690 to
acccbbe
Compare
|
JSON_PRESERVE_ZERO_FRACTION should be default behavior |
|
But that would be a big BC break. So unless we want to release 3.0 the default behaviour should stay the same. |
acccbbe to
05a3b32
Compare
|
To pass all options goes against the spirit of this class. I agree that JSON_PRESERVE_ZERO_FRACTION should be default in 3.0 (due to compatibility and due to minimal required PHP version) because stripping zero fraction is It is not BC break when you export from PHP to JavaScript, but it is BC break when you export from PHP to PHP. The question is whether it's a problem or bugfix. |
|
I see JSON_PRESERVE_ZERO_FRACTION as bugfix. The previous behavior makes not sense. Why would anyone expect and rely on |
|
It might make no sense, but it's the current behaviour and you can't make any assumptions whether applications rely on it or not. |
|
What? Of course you can make assumptions. Otherwise you will never change anything cause everything change is BC break. |
|
It's OK to do BC breaks but not in a patch or minor version. |
Main motivation is to be able to use
JSON_PRESERVE_ZERO_FRACTIONwhile still benefitting from other features of Json::encode like error detection.There are no intentional BC breaks involved.