]> granicus.if.org Git - php/commitdiff
Avoid getThis() usages in zip extension
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 6 Aug 2020 09:28:35 +0000 (11:28 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 6 Aug 2020 09:28:35 +0000 (11:28 +0200)
There isn't any magic going on here, we can just use ZEND_THIS
and assume it exists.

ext/zip/php_zip.c

index 841488bd618ba86510918f43b91642a9712dd636..de3a695d96401fd1b903da2dcf0e717cf2b46777 100644 (file)
@@ -2884,15 +2884,11 @@ static void _php_zip_progress_callback(zip_t *arch, double state, void *ptr)
 PHP_METHOD(ZipArchive, registerProgressCallback)
 {
        struct zip *intern;
-       zval *self = getThis();
+       zval *self = ZEND_THIS;
        double rate;
        zval *callback;
        ze_zip_object *obj;
 
-       if (!self) {
-               RETURN_FALSE;
-       }
-
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "dz", &rate, &callback) == FAILURE) {
                return;
        }
@@ -2942,14 +2938,10 @@ static int _php_zip_cancel_callback(zip_t *arch, void *ptr)
 PHP_METHOD(ZipArchive, registerCancelCallback)
 {
        struct zip *intern;
-       zval *self = getThis();
+       zval *self = ZEND_THIS;
        zval *callback;
        ze_zip_object *obj;
 
-       if (!self) {
-               RETURN_FALSE;
-       }
-
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callback) == FAILURE) {
                return;
        }