Skip to content

Commit 1bd6faf

Browse files
committed
Fix preloading of trait property attributes
1 parent 5a7e1a7 commit 1bd6faf

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ext/opcache/tests/preload.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class x extends c implements a, b {
2424
}
2525

2626
trait T1 {
27+
#[A]
28+
public $prop;
29+
2730
static function foo() {
2831
var_dump(__METHOD__);
2932
}

ext/opcache/zend_persist.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ static HashTable *zend_persist_attributes(HashTable *attributes)
266266
return attributes;
267267
}
268268

269+
/* Attributes for trait properties may be shared if preloading is used. */
270+
HashTable *xlat = zend_shared_alloc_get_xlat_entry(attributes);
271+
if (xlat) {
272+
return xlat;
273+
}
274+
269275
zend_hash_persist(attributes);
270276

271277
ZEND_HASH_FOREACH_VAL(attributes, v) {

0 commit comments

Comments
 (0)