Skip to content

Commit

Permalink
ext/curl: Use Z_ARRVAL_P instead of HASH_OF
Browse files Browse the repository at this point in the history
We already check in advance that it is an array
  • Loading branch information
Girgias committed Nov 10, 2024
1 parent 23b8d64 commit 53df3ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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);
} ZEND_HASH_FOREACH_END();

Expand Down Expand Up @@ -2186,7 +2186,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue

case CURLOPT_POSTFIELDS:
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;
also works around https://github.com/curl/curl/issues/6455 */
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");
Expand Down

0 comments on commit 53df3ae

Please sign in to comment.