xref: /php-src/Zend/tests/bug79897.phpt (revision 2772751b)
1--TEST--
2bug79897: Promoted constructor params with attribs cause crash
3--FILE--
4<?php
5
6#[Attribute]
7class B {
8    public function __construct($value)
9    {
10    }
11}
12
13class A {
14    public function __construct(
15        #[B(12, X)] public $b
16    )
17    {
18    }
19}
20
21const X = 42;
22
23var_dump((new ReflectionParameter(['A', '__construct'], 'b'))->getAttributes()[0]->getArguments());
24var_dump((new ReflectionProperty('A', 'b'))->getAttributes()[0]->getArguments());
25?>
26--EXPECT--
27array(2) {
28  [0]=>
29  int(12)
30  [1]=>
31  int(42)
32}
33array(2) {
34  [0]=>
35  int(12)
36  [1]=>
37  int(42)
38}
39