Fix preloading of trait property attributes

This commit is contained in:
Nikita Popov 2021-07-27 12:07:22 +02:00
parent 5a7e1a7aa8
commit 1bd6fafa2f
2 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,9 @@ class x extends c implements a, b {
}
trait T1 {
#[A]
public $prop;
static function foo() {
var_dump(__METHOD__);
}

View File

@ -266,6 +266,12 @@ static HashTable *zend_persist_attributes(HashTable *attributes)
return attributes;
}
/* Attributes for trait properties may be shared if preloading is used. */
HashTable *xlat = zend_shared_alloc_get_xlat_entry(attributes);
if (xlat) {
return xlat;
}
zend_hash_persist(attributes);
ZEND_HASH_FOREACH_VAL(attributes, v) {