xref: /PHP-8.2/ext/reflection/tests/bug81208.phpt (revision b976bc44)
1--TEST--
2Bug #81208: Segmentation fault while create newInstance from attribute
3--FILE--
4<?php
5
6#[Attribute(Attribute::TARGET_PROPERTY)]
7class MyAnnotation
8{
9    public function __construct(public bool $nullable = false) {}
10}
11
12class MyClass {
13    #[MyAnnotation(name: "my_name", type: "integer", nullable: asdasdasd)]
14    public $property;
15}
16
17$z = new ReflectionClass(MyClass::class);
18foreach ($z->getProperty("property")->getAttributes() as $attribute) {
19    try {
20        $attribute->newInstance();
21    } catch (Error $e) {
22        echo $e->getMessage(), "\n";
23    }
24}
25
26?>
27--EXPECT--
28Undefined constant "asdasdasd"
29