X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-json_post;a=blobdiff_plain;f=php_json_post.c;fp=php_json_post.c;h=c2e5ba69eabb4618b45c5c541a451472d351c959;hp=d9b72957726301f2eaf256fa75699a711570b149;hb=88d61717dea2609ba0f358c87c0d540cfc3ec10a;hpb=c4e41f13aea0c8927e5f88ea5602150f87041164 diff --git a/php_json_post.c b/php_json_post.c index d9b7295..c2e5ba6 100644 --- a/php_json_post.c +++ b/php_json_post.c @@ -68,8 +68,13 @@ static SAPI_POST_HANDLER_FUNC(php_json_post_handler) switch (Z_TYPE(tmp)) { case IS_OBJECT: case IS_ARRAY: - zval_dtor(arg); - ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_POST], &tmp); + if (zend_hash_num_elements(HASH_OF(&tmp))) { + zval_dtor(arg); + ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_POST], &tmp); + } else { + /* PHP-7.4 optimizes empty array */ + zval_ptr_dtor(&tmp); + } break; default: break;