From aed94e2ca8e551d79c3dae01331e1f94493ec5c2 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 7 Sep 2021 13:18:14 +0300 Subject: [PATCH] JIT: improved code for protected properties access --- ext/opcache/jit/zend_jit.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 4afad9d6a5c..387f4c88651 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -640,12 +640,18 @@ static zend_property_info* zend_get_known_property_info(const zend_op_array *op_ return NULL; } - if (!(info->flags & ZEND_ACC_PUBLIC) && - (!on_this || info->ce != ce)) { - return NULL; + if (info->flags & ZEND_ACC_PUBLIC) { + return info; + } else if (on_this) { + if (ce == info->ce) { + return info; + } else if ((info->flags & ZEND_ACC_PROTECTED) + && instanceof_function_slow(ce, info->ce)) { + return info; + } } - return info; + return NULL; } static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *member, bool on_this, zend_string *filename)