diff options
-rw-r--r-- | ext/curl/interface.c | 4 | ||||
-rw-r--r-- | ext/curl/tests/bug79741.phpt | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 7d57df8f78..01742ba3e5 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2183,7 +2183,7 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields } #endif - ZEND_HASH_FOREACH_KEY_VAL(postfields, num_key, string_key, current) { + ZEND_HASH_FOREACH_KEY_VAL_IND(postfields, num_key, string_key, current) { zend_string *postval, *tmp_postval; /* Pretend we have a string_key here */ if (!string_key) { @@ -2919,7 +2919,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ return FAILURE; } - ZEND_HASH_FOREACH_VAL(ph, current) { + ZEND_HASH_FOREACH_VAL_IND(ph, current) { ZVAL_DEREF(current); val = zval_get_tmp_string(current, &tmp_val); slist = curl_slist_append(slist, ZSTR_VAL(val)); diff --git a/ext/curl/tests/bug79741.phpt b/ext/curl/tests/bug79741.phpt new file mode 100644 index 0000000000..17c3f57e04 --- /dev/null +++ b/ext/curl/tests/bug79741.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #79741: curl_setopt CURLOPT_POSTFIELDS asserts on object with declared properties +--FILE-- +<?php + +class Test { + public $prop = "value"; +} + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_POSTFIELDS, new Test); + +?> +===DONE=== +--EXPECT-- +===DONE=== |