I applied a few changes in
https://github.com/php/php-src/commit/84fe2cc890e49f40bac7c3ba74b3cfc6dc4cef2f
and 
https://github.com/php/php-src/commit/36fa17a5fae84ab332366a202f0a709279a2466a.

>From the commit message:
<<<<<
json_encode() now returns bool(false) for all possible errors, throws the
respective warning and also sets the respective json_last_error() error
code. Three new error codes have been added:

  * JSON_ERROR_RECURSION
  * JSON_ERROR_INF_OR_NAN
  * JSON_ERROR_UNSUPPORTED_TYPE

To get a partial JSON output instead of bool(false) the option
JSON_PARTIAL_OUTPUT_ON_ERROR can be specified. In this case the invalid
segments will be replaced either by null (for recursion, unsupported type
and invalid JSON) or 0 (for Inf and NaN).

The warning for invalid UTF-8 stays intact and is thrown also with
display_errors = On. If this behavior is undesired this can be remedied
later.
>>>>>

So all branches now behave the same: bool(false) is returned, a
warning is thrown and an error code is set.

For now I chose to always throw the warning, but if something else
comes out in conclusion to this discussion I'll gladly change it to
some other behavior.

Nikita

On Sat, Jun 23, 2012 at 12:50 PM, Sherif Ramadan
<theanomaly...@gmail.com> wrote:
> So in other words this patch I submitted should be fine?
>
> https://github.com/php/php-src/pull/111
>
> This particular patch doesn't raise any controversy since it doesn't
> touch any of that other stuff and simply puts the defined behavior
> back in place as it should have been.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to