]> granicus.if.org Git - php/commitdiff
Check for redundant func info
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jul 2020 09:10:53 +0000 (11:10 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jul 2020 11:01:12 +0000 (13:01 +0200)
ext/opcache/Optimizer/zend_func_info.c

index b8c62f54200a1f29f7451719cd22f2aeea242a03..1affffbee6349b5e03e73a55cdbeb4fd6f8c1d1c 100644 (file)
@@ -938,6 +938,11 @@ uint32_t zend_get_func_info(
                        if (internal_ret & ~ret) {
                                fprintf(stderr, "Inaccurate func info for %s()\n", ZSTR_VAL(lcname));
                        }
+                       /* Check whether the func info is completely redundant with arginfo.
+                        * Ignore UNKNOWN_INFO for now. */
+                       if (internal_ret == ret && (internal_ret & MAY_BE_ANY) != MAY_BE_ANY) {
+                               fprintf(stderr, "Useless func info for %s()\n", ZSTR_VAL(lcname));
+                       }
                        /* If the return type is not mixed, check that the types match exactly if we exclude
                         * RC and array information. */
                        uint32_t ret_any = ret & MAY_BE_ANY, internal_ret_any = internal_ret & MAY_BE_ANY;