X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=php_json_post.c;h=c2e5ba69eabb4618b45c5c541a451472d351c959;hb=3593b9eb6a9b428d30d6a85eb5ab2fc133160b4c;hp=4a0fcd30387a1d9346461aa53343e017a2e6e76b;hpb=e54f65df2bcb68b4493832c83c141da9f579964e;p=m6w6%2Fext-json_post diff --git a/php_json_post.c b/php_json_post.c index 4a0fcd3..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; @@ -136,6 +141,9 @@ PHP_MINIT_FUNCTION(json_post) { NULL, 0, NULL, NULL } }; +#ifndef TSRMLS_CC +# define TSRMLS_CC +#endif sapi_register_post_entries(json_post_entries TSRMLS_CC); ZEND_INIT_MODULE_GLOBALS(json_post, php_json_post_init_globals, NULL);