diff --git a/NEWS b/NEWS index fd622359608..753b0a076b7 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,10 @@ PHP NEWS . The __sleep() and __wakeup() magic methods have been deprecated. (Girgias) . Fixed hard_timeout with --enable-zend-max-execution-timers. (Appla) +- Curl: + . Fix cloning of CURLOPT_POSTFIELDS when using the clone operator instead + of the curl_copy_handle() function to clone a CurlHandle. (timwolla) + - Exif: . Fix OSS-Fuzz #442954659 (zero-size box in HEIF file causes infinite loop). (nielsdos) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 53098c64eb0..4bc47a68b56 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -423,7 +423,7 @@ static zend_object *curl_clone_obj(zend_object *object) { clone_ch->cp = cp; _php_setup_easy_copy_handlers(clone_ch, ch); - postfields = &clone_ch->postfields; + postfields = &ch->postfields; if (Z_TYPE_P(postfields) != IS_UNDEF) { if (build_mime_structure_from_hash(clone_ch, postfields) == FAILURE) { zend_throw_exception(NULL, "Failed to clone CurlHandle", 0); diff --git a/ext/curl/tests/curl_copy_handle_variation3_clone.phpt b/ext/curl/tests/curl_copy_handle_variation3_clone.phpt new file mode 100644 index 00000000000..7951cb02581 --- /dev/null +++ b/ext/curl/tests/curl_copy_handle_variation3_clone.phpt @@ -0,0 +1,34 @@ +--TEST-- +clone() allows to post CURLFile multiple times +--EXTENSIONS-- +curl +--FILE-- + $file); +var_dump(curl_setopt($ch1, CURLOPT_POSTFIELDS, $params)); + +$ch2 = clone($ch1); + +var_dump(curl_exec($ch1)); + +var_dump(curl_exec($ch2)); +?> +--EXPECTF-- +bool(true) +string(%d) "curl_copy_handle_variation3_clone.txt|application/octet-stream|5" +string(%d) "curl_copy_handle_variation3_clone.txt|application/octet-stream|5" +--CLEAN-- +