]> granicus.if.org Git - php/commitdiff
Don't inline static call to instance method
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 29 Jun 2020 07:52:37 +0000 (09:52 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 29 Jun 2020 07:52:37 +0000 (09:52 +0200)
Fixes the failure in bug79740.phpt with opcache.

ext/opcache/Optimizer/optimize_func_calls.c

index ae707a24097c047bc4b8383492d59002f6886948..6af7865e92172b6bdec82f40036c898f16d7d251 100644 (file)
@@ -106,6 +106,12 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o
                        uint32_t i, num_args = func->op_array.num_args;
                        num_args += (func->op_array.fn_flags & ZEND_ACC_VARIADIC) != 0;
 
+                       if (fcall->opcode == ZEND_INIT_STATIC_METHOD_CALL
+                                       && !(func->op_array.fn_flags & ZEND_ACC_STATIC)) {
+                               /* Don't inline static call to instance method. */
+                               return;
+                       }
+
                        if (fcall->opcode == ZEND_INIT_METHOD_CALL && fcall->op1_type == IS_UNUSED) {
                                /* TODO: we can't inlne methods, because $this may be used
                                 *       not in object context ???