Skip to content

Commit 966ceab

Browse files
Store attributes
1 parent 0ef14f0 commit 966ceab

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
@@ -538,6 +538,8 @@ ZEND_METHOD(ClassAlias, __construct)
538538
}
539539

540540
if (attributes == NULL || zend_hash_num_elements(attributes) == 0) {
541+
ZVAL_EMPTY_ARRAY(&value);
542+
zend_update_property(zend_ce_class_alias, Z_OBJ_P(ZEND_THIS), ZEND_STRL("attributes"), &value);
541543
return;
542544
}
543545

@@ -547,6 +549,8 @@ ZEND_METHOD(ClassAlias, __construct)
547549
);
548550
RETURN_THROWS();
549551
}
552+
ZVAL_ARR(&value, attributes);
553+
zend_update_property(zend_ce_class_alias, Z_OBJ_P(ZEND_THIS), ZEND_STRL("attributes"), &value);
550554
}
551555

552556
static zend_attribute *get_attribute(HashTable *attributes, 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
@@ -108,5 +108,7 @@ final class ClassAlias
108108
{
109109
public readonly string $alias;
110110

111+
public readonly array $attributes;
112+
111113
public function __construct(string $alias, array $attributes = []) {}
112114
}

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)