bug81208.phpt 617 B

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