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
Add support of JSON_THROW_ON_ERROR global constant #168
Conversation
-1 for that. Adding the constant without adding its behavior looks wrong to me. It forbids using feature detection based on the constant to know whether the constant can be relied on. This PR is not polyfilling support for |
btw, this was already discussed in #161 |
If follow your logic, then this package ( I think this is too radical statements.
Given this, I propose to implement the functionality that is possible to implement. |
@SerafimArts but what use does the constant have when you can't use it to toggle the associated feature? I'm 👎 here because it adds an mostly useless constant while bringing harm by preventing feature detection/silently ignoring bugs. |
Exactly the same as from JsonException exception class, which never happens or from these. And why does anyone need a polyfill of PHP 7.3, in which there are no constants added in PHP 7.3? For example, I use these constants and ensure that they work: https://github.com/railt/json/blob/1.4.x/src/Json/Rfc7159/NativeJsonDecoder.php#L85-L87 But due to the fact that the polyfill does not provide their definitions - I have to define them myself and in this case the polyfill that is obliged to do so becomes completely unnecessary. |
P.S. in my opinion, the very idea that someone will check something on the basis of the existence of this constant, and not on the basis of the version of the language is rather doubtful. Anyone might as well add a |
Well, I would be in favor of removing that one from the polyfill.
The thing is, polyfills should polyfill features, and in this case the feature is both, the class, the constant and the fact that
True, but what I fear is that someone will do |
Closing as the presented reasonings make sense for the const (+ I don't agree that we shouldn't add |
@jvasseur Well, you convinced me that it was a really bad idea to add this constant. Thank you for the constructive and reasoned dialogue. 👍 |
Added support of the
JSON_THROW_ON_ERROR
constant which was added in PHP 7.3https://secure.php.net/manual/en/json.constants.php#constant.json-throw-on-error