Skip to content

Commit 03e940e

Browse files
committed
rewrite scopes during opcache compilation
1 parent a18f78e commit 03e940e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

ext/opcache/zend_persist.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,27 @@ zend_class_entry *zend_persist_class_entry(zend_class_entry *orig_ce)
11211121
return ce;
11221122
}
11231123

1124+
void zend_update_ce_scopes(zend_class_entry *ce)
1125+
{
1126+
if (ce->required_scope) {
1127+
zend_class_entry *required_scope = ce->required_scope;
1128+
1129+
zend_class_entry *r = zend_shared_alloc_get_xlat_entry(required_scope);
1130+
if (r) {
1131+
ce->required_scope = r;
1132+
}
1133+
}
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+
}
1143+
}
1144+
11241145
void zend_update_parent_ce(zend_class_entry *ce)
11251146
{
11261147
if (ce->ce_flags & ZEND_ACC_LINKED) {
@@ -1294,6 +1315,7 @@ static void zend_accel_persist_class_table(HashTable *class_table)
12941315
if (EXPECTED(Z_TYPE(p->val) != IS_ALIAS_PTR)) {
12951316
ce = Z_PTR(p->val);
12961317
zend_update_parent_ce(ce);
1318+
zend_update_ce_scopes(ce);
12971319
}
12981320
} ZEND_HASH_FOREACH_END();
12991321
#ifdef HAVE_JIT

ext/reflection/php_reflection.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ public function getNamespaceName(): string {}
432432
public function getShortName(): string {}
433433

434434
public function getAttributes(?string $name = null, int $flags = 0): array {}
435-
435+
436436
public function isInnerClass(): bool {}
437437

438438
public function isPrivate(): bool {}

0 commit comments

Comments
 (0)