Hi internals!

We currently have a big mess concerning the behavior of json_encode()
with incorrectly encoded UTF-8 strings.

To summarize the situation:

PHP <= 5.3.13, PHP 5.4, master behave as follows when an invalid UTF-8
string is encountered:
 * The invalid string is replaced with "null", thus creating a partial
JSON serialization
 * json_encode() returns the partial serialization, *not* false as it should
 * A warning is thrown, but only if display_errors=off
 * json_last_error() returns JSON_ERROR_UTF8

PHP 5.3.14 behaves as follows:
 * json_encode() returns false, as it should
 * A warning is thrown always, even with display_errors=on
 * json_last_error() returns JSON_ERROR_UTF8
 * If the PHP_JSON_PARTIAL_OUTPUT_ON_ERROR option is specified, the
old behavior is restored

The reason for this situation is that a patch was applied for all
branches, and then reverted, because Stas didn't consider the change
towards always throwing a warning (even with display_errors=on)
appropriate without further discussion.

The backout though was done only on PHP 5.4 and master, but *not* on
the PHP 5.3 branch.

Thus we now have differing behavior between 5.3 and 5.4 (and PHP <= 5.3.13).

So, I'd like to ask whether the patch can be reapplied to 5.4 and
master or whether we should do something else to solve this problem.

Nikita

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

Reply via email to