Skip to content

Commit c5f3db8

Browse files
committed
fix opcache
1 parent bfd0564 commit c5f3db8

File tree

4 files changed

+108
-30
lines changed

4 files changed

+108
-30
lines changed

Zend/zend_compile.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,9 +2943,7 @@ static void zend_compile_inner_class_ref(znode *result, zend_ast *ast, uint32_t
29432943
zend_compile_expr(&inner_node, inner_class);
29442944
}
29452945

2946-
zend_op *opline = zend_emit_op(result, ZEND_FETCH_INNER_CLASS, &outer_node, &inner_node);
2947-
// ensure we allocate two slots to prevent an issue with static method access
2948-
opline->extended_value = zend_alloc_cache_slots(2);
2946+
zend_emit_op(result, ZEND_FETCH_INNER_CLASS, &outer_node, &inner_node);
29492947
}
29502948
/* }}} */
29512949

@@ -9222,6 +9220,7 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
92229220
} else {
92239221
name = zend_prefix_with_ns(unqualified_name);
92249222
ce->required_scope = NULL;
9223+
ce->lexical_scope = NULL;
92259224
}
92269225
name = zend_new_interned_string(name);
92279226
lcname = zend_string_tolower(name);

Zend/zend_execute.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ static zend_always_inline bool zend_check_class_visibility(const zend_class_entr
10611061
return 0;
10621062
}
10631063

1064-
return 0;
1064+
return 1;
10651065
}
10661066

10671067
// a private class is visible if it is the same class as the lexical scope and the current visibility is private
@@ -1088,14 +1088,6 @@ static zend_always_inline bool i_zend_verify_property_type(const zend_property_i
10881088
return 1;
10891089
}
10901090

1091-
// todo:
1092-
// 1: add a flag to the type so we can tell the type is an inner class
1093-
// 2: use said flag to flag the property info
1094-
// 3: same with parameters/args too
1095-
// 4: create a simple function to take a visibility flag and ce, it should return SUCCESS if the ce can be used
1096-
// 5: if we have an inner class in a prop/arg, we validate it can be returned (do not autoload) by looping over types
1097-
// that are inner classes and looking up the ce. If it is not autoloaded, then it is not going to match the type anyway.
1098-
10991091
zend_verify_property_type_error(info, property);
11001092
return 0;
11011093
}

Zend/zend_vm_execute.h

Lines changed: 96 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/opcache/zend_persist.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,15 @@ void zend_update_required_scope(zend_class_entry *ce)
11311131
ce->required_scope = r;
11321132
}
11331133
}
1134+
1135+
if (ce->lexical_scope) {
1136+
zend_class_entry *lexical_scope = ce->lexical_scope;
1137+
1138+
zend_class_entry *l = zend_shared_alloc_get_xlat_entry(lexical_scope);
1139+
if (l) {
1140+
ce->lexical_scope = l;
1141+
}
1142+
}
11341143
}
11351144

11361145
void zend_update_parent_ce(zend_class_entry *ce)

0 commit comments

Comments
 (0)