projects
/
m6w6
/
ext-json_post
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
| inline |
side by side
(parent:
c4e41f1
)
fix #1: Segfault on PHP 7.4 with empty array
author
Michael Wallner
<mike@php.net>
Wed, 13 May 2020 12:25:56 +0000
(14:25 +0200)
committer
Michael Wallner
<mike@php.net>
Wed, 13 May 2020 12:25:56 +0000
(14:25 +0200)
closes #2
php_json_post.c
patch
|
blob
|
history
diff --git
a/php_json_post.c
b/php_json_post.c
index d9b72957726301f2eaf256fa75699a711570b149..c2e5ba69eabb4618b45c5c541a451472d351c959 100644
(file)
--- 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;