Skip to content

Commit 15f713b

Browse files
committed
Persist class name before methods, because it may be used insted of "self"
1 parent 1f3f7c4 commit 15f713b

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

ext/opcache/zend_persist.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,13 @@ zend_class_entry *zend_persist_class_entry(zend_class_entry *orig_ce)
846846
}
847847
ce->inheritance_cache = NULL;
848848

849+
if (!(ce->ce_flags & ZEND_ACC_CACHED)) {
850+
zend_accel_store_interned_string(ce->name);
851+
if (ce->parent_name && !(ce->ce_flags & ZEND_ACC_LINKED)) {
852+
zend_accel_store_interned_string(ce->parent_name);
853+
}
854+
}
855+
849856
zend_hash_persist(&ce->function_table);
850857
ZEND_HASH_FOREACH_BUCKET(&ce->function_table, p) {
851858
ZEND_ASSERT(p->key != NULL);
@@ -950,11 +957,6 @@ zend_class_entry *zend_persist_class_entry(zend_class_entry *orig_ce)
950957

951958
ce->ce_flags |= ZEND_ACC_CACHED;
952959

953-
zend_accel_store_interned_string(ce->name);
954-
if (ce->parent_name && !(ce->ce_flags & ZEND_ACC_LINKED)) {
955-
zend_accel_store_interned_string(ce->parent_name);
956-
}
957-
958960
if (ce->info.user.filename) {
959961
zend_accel_store_string(ce->info.user.filename);
960962
}

ext/opcache/zend_persist_calc.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,13 @@ void zend_persist_class_entry_calc(zend_class_entry *ce)
387387

388388
ADD_SIZE(sizeof(zend_class_entry));
389389

390+
if (!(ce->ce_flags & ZEND_ACC_CACHED)) {
391+
ADD_INTERNED_STRING(ce->name);
392+
if (ce->parent_name && !(ce->ce_flags & ZEND_ACC_LINKED)) {
393+
ADD_INTERNED_STRING(ce->parent_name);
394+
}
395+
}
396+
390397
zend_hash_persist_calc(&ce->function_table);
391398
ZEND_HASH_FOREACH_BUCKET(&ce->function_table, p) {
392399
ZEND_ASSERT(p->key != NULL);
@@ -444,11 +451,6 @@ void zend_persist_class_entry_calc(zend_class_entry *ce)
444451
return;
445452
}
446453

447-
ADD_INTERNED_STRING(ce->name);
448-
if (ce->parent_name && !(ce->ce_flags & ZEND_ACC_LINKED)) {
449-
ADD_INTERNED_STRING(ce->parent_name);
450-
}
451-
452454
if (ce->info.user.filename) {
453455
ADD_STRING(ce->info.user.filename);
454456
}

0 commit comments

Comments
 (0)