Skip to content

Commit 75f3dd9

Browse files
committed
ensure we do not escape class scope boundaries
1 parent 495fb67 commit 75f3dd9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Zend/zend_object_handlers.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c
403403
goto dynamic;
404404
} else {
405405
wrong:
406-
if (scope && scope->lexical_scope) {
406+
if (scope && scope->lexical_scope && scope->lexical_scope->type != ZEND_NAMESPACE_CLASS) {
407407
scope = scope->lexical_scope;
408408
goto check_lexical_scope;
409409
}
@@ -1839,7 +1839,7 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
18391839
if (zobj->ce->__call) {
18401840
fbc = zend_get_user_call_function(zobj->ce, method_name);
18411841
} else {
1842-
if (scope && scope->lexical_scope) {
1842+
if (scope && scope->lexical_scope && scope->lexical_scope->type != ZEND_NAMESPACE_CLASS) {
18431843
scope = scope->lexical_scope;
18441844
goto check_lexical_scope;
18451845
}
@@ -1909,7 +1909,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
19091909
|| UNEXPECTED(!zend_check_protected(zend_get_function_root_class(fbc), scope))) {
19101910
zend_function *fallback_fbc = get_static_method_fallback(ce, function_name);
19111911
if (!fallback_fbc) {
1912-
if (scope && scope->lexical_scope) {
1912+
if (scope && scope->lexical_scope && scope->lexical_scope->type != ZEND_NAMESPACE_CLASS) {
19131913
scope = scope->lexical_scope;
19141914
goto check_lexical_scope;
19151915
}
@@ -1996,7 +1996,7 @@ ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend
19961996
if (UNEXPECTED(property_info->flags & ZEND_ACC_PRIVATE)
19971997
|| UNEXPECTED(!is_protected_compatible_scope(property_info->ce, scope))) {
19981998
if (type != BP_VAR_IS) {
1999-
if (scope && scope->lexical_scope) {
1999+
if (scope && scope->lexical_scope && scope->lexical_scope->type != ZEND_NAMESPACE_CLASS) {
20002000
scope = scope->lexical_scope;
20012001
goto check_lexical_scope;
20022002
}
@@ -2084,7 +2084,7 @@ ZEND_API zend_function *zend_std_get_constructor(zend_object *zobj) /* {{{ */
20842084
if (UNEXPECTED(constructor->common.scope != scope)) {
20852085
if (UNEXPECTED(constructor->op_array.fn_flags & ZEND_ACC_PRIVATE)
20862086
|| UNEXPECTED(!zend_check_protected(zend_get_function_root_class(constructor), scope))) {
2087-
if (scope && scope->lexical_scope) {
2087+
if (scope && scope->lexical_scope && scope->lexical_scope->type != ZEND_NAMESPACE_CLASS) {
20882088
scope = scope->lexical_scope;
20892089
goto check_lexical_scope;
20902090
}

0 commit comments

Comments
 (0)