Skip to content

segfault in ReflectionProperty::__toString() when default value is an enum #8444

Closed
@nicolas-grekas

Description

@nicolas-grekas

Description

The following code:

<?php
  
enum Foo
{
    case bar;
}

class Bar
{
    public Foo $enum = Foo::bar;
}

$c = new Bar;

echo new \ReflectionProperty($c, 'enum');

Resulted in a segfault on PHP 8.1.

Resulted in this on PHP 8.2, which is also wrong:
Property [ public Foo $enum = callable ]

I'd expect the AST to be dumped instead (see #7540).

PHP Version

PHP 8.1+

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions