diff -Nru php-json-1.3.7/debian/changelog php-json-1.3.7/debian/changelog --- php-json-1.3.7/debian/changelog 2015-07-08 06:48:57.000000000 -0700 +++ php-json-1.3.7/debian/changelog 2016-04-06 15:44:24.000000000 -0700 @@ -1,3 +1,10 @@ +php-json (1.3.7-1ubuntu1) wily; urgency=medium + + * debian/patches/backport-f73f0a12.patch: Backport fix for upstream + issue #9. Closes LP: #1287726. + + -- Nishanth Aravamudan Wed, 06 Apr 2016 15:44:13 -0700 + php-json (1.3.7-1) unstable; urgency=medium * New upstream version 1.3.7 diff -Nru php-json-1.3.7/debian/control php-json-1.3.7/debian/control --- php-json-1.3.7/debian/control 2015-07-08 06:48:57.000000000 -0700 +++ php-json-1.3.7/debian/control 2016-04-06 15:44:30.000000000 -0700 @@ -1,7 +1,8 @@ Source: php-json Section: php Priority: optional -Maintainer: Debian PHP PECL Maintainers +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian PHP PECL Maintainers Uploaders: Ondřej Surý , Lior Kaplan Build-Depends: debhelper (>= 9), php5-dev (>= 5.5.0~rc1+dfsg-1~), diff -Nru php-json-1.3.7/debian/patches/backport-f73f0a12.patch php-json-1.3.7/debian/patches/backport-f73f0a12.patch --- php-json-1.3.7/debian/patches/backport-f73f0a12.patch 1969-12-31 16:00:00.000000000 -0800 +++ php-json-1.3.7/debian/patches/backport-f73f0a12.patch 2016-04-06 15:52:30.000000000 -0700 @@ -0,0 +1,110 @@ +Description: Backport fix for upstream issue #9 +Author: Nishanth Aravamudan +Origin: upstream, https://github.com/remicollet/pecl-json-c/commit/f73f0a12d40f82bb4bc60bfaa9226ad712d15e38 +Bug: https://github.com/remicollet/pecl-json-c/issues/9 +Bug-Ubuntu: https://launchpad.net/bugs/1287726 + +Index: gitwd/jsonc-1.3.7/json.c +=================================================================== +--- gitwd.orig/jsonc-1.3.7/json.c ++++ gitwd/jsonc-1.3.7/json.c +@@ -495,7 +495,7 @@ static void json_encode_array(smart_str + /* }}} */ + + +-static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{{ */ ++static int json_utf8_to_utf16(unsigned short *utf16, const char utf8[], int len) /* {{{ */ + { + size_t pos = 0, us; + int j, status; +@@ -829,7 +829,17 @@ static void json_object_to_zval(json_obj + break; + + case json_type_string: +- RETVAL_STRINGL(json_object_get_string(new_obj), json_object_get_string_len(new_obj), 1); ++ { ++ const char *str = json_object_get_string(new_obj); ++ int len = json_object_get_string_len(new_obj); ++ ++ if (!(options & PHP_JSON_PARSER_NOTSTRICT) && ++ json_utf8_to_utf16(NULL, str, len) < 0) { ++ JSON_G(error_code) = PHP_JSON_ERROR_UTF8; ++ } else { ++ RETVAL_STRINGL(str, len, 1); ++ } ++ } + break; + + case json_type_int: +@@ -886,6 +896,10 @@ static void json_object_to_zval(json_obj + while (!json_object_iter_equal(&it, &itEnd)) { + MAKE_STD_ZVAL(tmpval); + key = json_object_iter_peek_name(&it); ++ if (!(options & PHP_JSON_PARSER_NOTSTRICT) && ++ json_utf8_to_utf16(NULL, key, strlen(key)) < 0) { ++ JSON_G(error_code) = PHP_JSON_ERROR_UTF8; ++ } + tmpobj = json_object_iter_peek_value(&it); + json_object_to_zval(tmpobj, tmpval, options TSRMLS_CC); + +@@ -917,6 +931,7 @@ PHP_JSON_API void php_json_decode_ex(zva + RETURN_NULL(); + } + ++ JSON_G(error_code) = 0; + RETVAL_NULL(); + + tok = json_tokener_new_ex(depth); +@@ -934,6 +949,10 @@ PHP_JSON_API void php_json_decode_ex(zva + if (new_obj) { + json_object_to_zval(new_obj, return_value, options TSRMLS_CC); + json_object_put(new_obj); ++ if (JSON_G(error_code)) { // UTF8 error during conversion to zval ++ zval_ptr_dtor(&return_value); ++ RETVAL_NULL(); ++ } + } else { + switch (json_tokener_get_error(tok)) { + case json_tokener_success: +Index: gitwd/jsonc-1.3.7/tests/issue9.phpt +=================================================================== +--- /dev/null ++++ gitwd/jsonc-1.3.7/tests/issue9.phpt +@@ -0,0 +1,37 @@ ++--TEST-- ++Issue #9 json_decode: invalid UTF-8 characters ++--SKIPIF-- ++ ++Done ++--EXPECT-- ++NULL ++int(5) ++string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" ++string(4) "c1bf" ++NULL ++bool(true) ++NULL ++bool(true) ++Done diff -Nru php-json-1.3.7/debian/patches/series php-json-1.3.7/debian/patches/series --- php-json-1.3.7/debian/patches/series 2015-07-08 06:48:57.000000000 -0700 +++ php-json-1.3.7/debian/patches/series 2016-04-06 15:42:56.000000000 -0700 @@ -0,0 +1 @@ +backport-f73f0a12.patch