Skip to content

Commit dcef3d4

Browse files
Store attributes
1 parent 54b9ace commit dcef3d4

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

Zend/tests/attributes/class_alias/runtime_attributes_validation_non-attribute.phpt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ object(ReflectionAttribute)#%d (1) {
2020
["name"]=>
2121
string(10) "ClassAlias"
2222
}
23-
object(ClassAlias)#%d (1) {
23+
object(ClassAlias)#%d (2) {
2424
["alias"]=>
2525
string(5) "Other"
26+
["attributes"]=>
27+
array(1) {
28+
[0]=>
29+
object(NonAttribute)#%d (0) {
30+
}
31+
}
2632
}

Zend/zend_attributes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,8 @@ ZEND_METHOD(ClassAlias, __construct)
586586
}
587587

588588
if (attributes == NULL || zend_hash_num_elements(attributes) == 0) {
589+
ZVAL_EMPTY_ARRAY(&value);
590+
zend_update_property(zend_ce_class_alias, Z_OBJ_P(ZEND_THIS), ZEND_STRL("attributes"), &value);
589591
return;
590592
}
591593

@@ -595,6 +597,8 @@ ZEND_METHOD(ClassAlias, __construct)
595597
);
596598
RETURN_THROWS();
597599
}
600+
ZVAL_ARR(&value, attributes);
601+
zend_update_property(zend_ce_class_alias, Z_OBJ_P(ZEND_THIS), ZEND_STRL("attributes"), &value);
598602
}
599603

600604
static zend_attribute *get_attribute(const HashTable *attributes, const zend_string *lcname, uint32_t offset)

Zend/zend_attributes.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,7 @@ final class ClassAlias
114114
{
115115
public readonly string $alias;
116116

117+
public readonly array $attributes;
118+
117119
public function __construct(string $alias, array $attributes = []) {}
118120
}

Zend/zend_attributes_arginfo.h

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)