Skip to content

Commit aed94e2

Browse files
committed
JIT: improved code for protected properties access
1 parent 1bb6cf5 commit aed94e2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,18 @@ static zend_property_info* zend_get_known_property_info(const zend_op_array *op_
640640
return NULL;
641641
}
642642

643-
if (!(info->flags & ZEND_ACC_PUBLIC) &&
644-
(!on_this || info->ce != ce)) {
645-
return NULL;
643+
if (info->flags & ZEND_ACC_PUBLIC) {
644+
return info;
645+
} else if (on_this) {
646+
if (ce == info->ce) {
647+
return info;
648+
} else if ((info->flags & ZEND_ACC_PROTECTED)
649+
&& instanceof_function_slow(ce, info->ce)) {
650+
return info;
651+
}
646652
}
647653

648-
return info;
654+
return NULL;
649655
}
650656

651657
static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *member, bool on_this, zend_string *filename)

0 commit comments

Comments
 (0)