summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-06-26 12:26:46 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-06-26 12:28:39 +0200
commit43cd3f68143eb6b35e19605855dac45db4007fc1 (patch)
tree87894dce63438a9ff9f7d3373f850646bb7c6739
parent4a26628b292b7735d1d220509eab1155346ddc6e (diff)
downloadphp-git-43cd3f68143eb6b35e19605855dac45db4007fc1.tar.gz
Fixed bug #79741
-rw-r--r--NEWS4
-rw-r--r--ext/curl/interface.c4
-rw-r--r--ext/curl/tests/bug79741.phpt16
3 files changed, 22 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index eb71c9f984..c5051c26a4 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP NEWS
. Fixed bug #79030 (Upgrade apache2handler's php_apache_sapi_get_request_time
to return usec). (Herbert256)
+- Curl:
+ . Fixed bug #79741 (curl_setopt CURLOPT_POSTFIELDS asserts on object with
+ declared properties). (Nikita)
+
- FTP:
. Fixed bug #55857 (ftp_size on large files). (cmb)
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 630d3b0a89..ebe01a9d8d 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -2719,7 +2719,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));
@@ -2797,7 +2797,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
}
#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) {
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===