Skip to content

Commit 029a788

Browse files
authored
Simplify callers of zval_try_get_long() (#18830)
Since 2b38384 references are handled properly by the Zend API, so we can simplify the callers by removing reference handling from there.
1 parent def3a95 commit 029a788

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

ext/curl/share.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ PHP_FUNCTION(curl_share_init_persistent)
160160
}
161161

162162
ZEND_HASH_FOREACH_VAL(share_opts, zval *entry) {
163-
ZVAL_DEREF(entry);
164-
165-
bool failed = false;
163+
bool failed;
166164
zend_ulong option = zval_try_get_long(entry, &failed);
167165

168166
if (failed) {

ext/zip/php_zip.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,13 +3037,11 @@ static int php_zip_cancel_callback(zip_t *arch, void *ptr)
30373037
/* Cancel if an exception has been thrown */
30383038
return -1;
30393039
}
3040-
bool failed = false;
3041-
zval *cb_retval_ptr = &cb_retval;
3042-
ZVAL_DEREF(cb_retval_ptr);
3043-
zend_long retval = zval_try_get_long(cb_retval_ptr, &failed);
3040+
bool failed;
3041+
zend_long retval = zval_try_get_long(&cb_retval, &failed);
30443042
if (failed) {
30453043
zend_type_error("Return value of callback provided to ZipArchive::registerCancelCallback()"
3046-
" must be of type int, %s returned", zend_zval_value_name(cb_retval_ptr));
3044+
" must be of type int, %s returned", zend_zval_value_name(&cb_retval));
30473045
zval_ptr_dtor(&cb_retval);
30483046
return -1;
30493047
}

0 commit comments

Comments
 (0)