com php-src: Merge branch 'PHP-5.4' into PHP-5.5: NEWS ext/json/json.c
| From: | Stanislav Malyshev | Date: | Mon, 14 Apr 2014 01:55:28 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.4' into PHP-5.5: NEWS ext/json/json.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76868@lists.php.net to get a copy of this message | ||
Commit: 9bba219c75b0fa82846bc2fa260888cdc97ac6e6
Author: Stanislav Malyshev <stas@php.net> Sun, 13 Apr 2014 18:54:54 -0700
Parents: 30ec1c005188e523eabc90741b3d8eda0cb81070 5e66ce929350b98003becd362464d47e8f49c8fb
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9bba219c75b0fa82846bc2fa260888cdc97ac6e6
Log:
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
Fix #66021 (Blank line inside empty array/object)
Bugs:
https://bugs.php.net/66021
Changed paths:
MM NEWS
MM ext/json/json.c
Diff:
diff --cc NEWS
index 3de1f3d,d04e961..f571b56
--- a/NEWS
+++ b/NEWS
@@@ -29,11 -29,7 +29,15 @@@ PH
(Remi)
- FPM:
- . Fixed bug #66482 (unknown entry 'priority' in php-fpm.conf).
+ . Fixed bug #66482 (unknown entry 'priority' in php-fpm.conf).
+
++- JSON:
++ . Fixed bug #66021 (Blank line inside empty array/object when
++ JSON_PRETTY_PRINT is set). (Kevin Israel)
++
+- mysqli:
+ . Fixed problem in mysqli_commit()/mysqli_rollback() with second parameter
+ (extra comma) and third parameters (lack of escaping). (Andrey)
- SimpleXML:
. Fixed bug #66084 (simplexml_load_string() mangles empty node name)
diff --cc ext/json/json.c
index b0191c3,b3240e1...6b66dce
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@@ -343,12 -330,13 +341,16 @@@ static void json_encode_array(smart_st
}
}
+ if (JSON_G(encoder_depth) > JSON_G(encode_max_depth)) {
+ JSON_G(error_code) = PHP_JSON_ERROR_DEPTH;
+ }
--JSON_G(encoder_depth);
- json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
- json_pretty_print_indent(buf, options TSRMLS_CC);
+
+ /* Only keep closing bracket on same line for empty arrays/objects */
+ if (need_comma) {
+ json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
+ json_pretty_print_indent(buf, options TSRMLS_CC);
+ }
if (r == PHP_JSON_OUTPUT_ARRAY) {
smart_str_appendc(buf, ']');