ext/curl: Use Z_ARRVAL_P instead of HASH_OF

We already check in advance that it is an array
This commit is contained in:
Gina Peter Banyard 2024-11-10 21:31:52 +00:00
parent 23b8d64cf7
commit 53df3ae1e5
No known key found for this signature in database
GPG key ID: 3306078E3194AEBD

View file

@ -1540,7 +1540,7 @@ static inline zend_result build_mime_structure_from_hash(php_curl *ch, zval *zpo
if (Z_TYPE_P(current) == IS_ARRAY) { if (Z_TYPE_P(current) == IS_ARRAY) {
zval *current_element; zval *current_element;
ZEND_HASH_FOREACH_VAL(HASH_OF(current), current_element) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(current), current_element) {
add_simple_field(mime, string_key, current_element); add_simple_field(mime, string_key, current_element);
} ZEND_HASH_FOREACH_END(); } ZEND_HASH_FOREACH_END();
@ -2186,7 +2186,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
case CURLOPT_POSTFIELDS: case CURLOPT_POSTFIELDS:
if (Z_TYPE_P(zvalue) == IS_ARRAY) { if (Z_TYPE_P(zvalue) == IS_ARRAY) {
if (zend_hash_num_elements(HASH_OF(zvalue)) == 0) { if (zend_hash_num_elements(Z_ARRVAL_P(zvalue)) == 0) {
/* no need to build the mime structure for empty hashtables; /* no need to build the mime structure for empty hashtables;
also works around https://github.com/curl/curl/issues/6455 */ also works around https://github.com/curl/curl/issues/6455 */
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, ""); curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");