mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
2772751b58
Instead of setting the old AST type to zero, replace the AST with the compiled constexpr AST zval. This requires passing in a zend_ast** instead of a zend_ast*. This allows compiling ASTs containing constexprs multiple times -- the second time, the existing compiled representation will be resused. This means we no longer need to copy the attributes AST for promoted properties.
39 lines
569 B
PHP
39 lines
569 B
PHP
--TEST--
|
|
bug79897: Promoted constructor params with attribs cause crash
|
|
--FILE--
|
|
<?php
|
|
|
|
#[Attribute]
|
|
class B {
|
|
public function __construct($value)
|
|
{
|
|
}
|
|
}
|
|
|
|
class A {
|
|
public function __construct(
|
|
#[B(12, X)] public $b
|
|
)
|
|
{
|
|
}
|
|
}
|
|
|
|
const X = 42;
|
|
|
|
var_dump((new ReflectionParameter(['A', '__construct'], 'b'))->getAttributes()[0]->getArguments());
|
|
var_dump((new ReflectionProperty('A', 'b'))->getAttributes()[0]->getArguments());
|
|
?>
|
|
--EXPECT--
|
|
array(2) {
|
|
[0]=>
|
|
int(12)
|
|
[1]=>
|
|
int(42)
|
|
}
|
|
array(2) {
|
|
[0]=>
|
|
int(12)
|
|
[1]=>
|
|
int(42)
|
|
}
|