]> granicus.if.org Git - php/commitdiff
Respect static method visibility
authorDmitry Stogov <dmitry@zend.com>
Thu, 27 Dec 2018 07:42:52 +0000 (10:42 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 27 Dec 2018 07:42:52 +0000 (10:42 +0300)
ext/opcache/Optimizer/zend_optimizer.c

index 6d2a31b2385de390a135fe9afefc9d02cfacd4ac..e70696c26b4812929093dbc175fc5c0966fd6a88 100644 (file)
@@ -984,7 +984,14 @@ zend_function *zend_optimizer_get_called_func(
                                        script, op_array, opline, rt_constants);
                                if (ce) {
                                        zend_string *func_name = Z_STR_P(GET_OP(op2) + 1);
-                                       return zend_hash_find_ptr(&ce->function_table, func_name);
+                                       zend_function *fbc = zend_hash_find_ptr(&ce->function_table, func_name);
+                                       if (fbc) {
+                                               zend_bool is_public = (fbc->common.fn_flags & ZEND_ACC_PUBLIC) != 0;
+                                               zend_bool same_scope = fbc->common.scope == op_array->scope;
+                                               if (is_public|| same_scope) {
+                                                       return fbc;
+                                               }
+                                       }
                                }
                        }
                        break;