Skip to content

Commit 2468119

Browse files
committed
Fixed parameter offset bug. Refined test case to detect this.
1 parent 4e8bba9 commit 2468119

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Zend/tests/attributes/001_placement.phpt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,68 +43,83 @@ $sources = [
4343
];
4444

4545
foreach ($sources as $r) {
46-
foreach ($r->getAttributes() as $attr) {
47-
var_dump($attr->getName(), $attr->getArguments());
46+
$attr = $r->getAttributes();
47+
var_dump(count($attr));
48+
49+
foreach ($attr as $a) {
50+
var_dump($a->getName(), $a->getArguments());
4851
}
4952
}
5053

5154
?>
5255
--EXPECT--
56+
int(1)
5357
string(2) "A1"
5458
array(1) {
5559
[0]=>
5660
int(1)
5761
}
62+
int(1)
5863
string(2) "A1"
5964
array(1) {
6065
[0]=>
6166
int(2)
6267
}
68+
int(1)
6369
string(2) "A1"
6470
array(1) {
6571
[0]=>
6672
int(2)
6773
}
74+
int(1)
6875
string(2) "A1"
6976
array(1) {
7077
[0]=>
7178
int(3)
7279
}
80+
int(1)
7381
string(2) "A1"
7482
array(1) {
7583
[0]=>
7684
int(3)
7785
}
86+
int(1)
7887
string(2) "A1"
7988
array(1) {
8089
[0]=>
8190
int(4)
8291
}
92+
int(1)
8393
string(2) "A1"
8494
array(1) {
8595
[0]=>
8696
int(5)
8797
}
98+
int(1)
8899
string(2) "A1"
89100
array(1) {
90101
[0]=>
91102
int(6)
92103
}
104+
int(1)
93105
string(2) "A1"
94106
array(1) {
95107
[0]=>
96108
int(7)
97109
}
110+
int(1)
98111
string(2) "A1"
99112
array(1) {
100113
[0]=>
101114
int(8)
102115
}
116+
int(1)
103117
string(2) "A1"
104118
array(1) {
105119
[0]=>
106120
int(9)
107121
}
122+
int(1)
108123
string(2) "A1"
109124
array(1) {
110125
[0]=>

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5769,7 +5769,7 @@ static void zend_compile_attributes(HashTable *attributes, zend_ast *ast, uint32
57695769
ZEND_ASSERT(ast->kind == ZEND_AST_ATTRIBUTE_LIST);
57705770

57715771
for (i = 0; i < list->children; i++) {
5772-
zend_attribute *attr = zend_compile_attribute(list->child[i], 0);
5772+
zend_attribute *attr = zend_compile_attribute(list->child[i], offset);
57735773

57745774
// Validate internal attribute
57755775
zend_attributes_internal_validator validator = zend_hash_find_ptr(&zend_attributes_internal_validators, attr->lcname);

0 commit comments

Comments
 (0)