Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[PropertyInfo] PropertyInfo is not compatible with PHP 8.4 property hooks #58556

Copy link
Copy link
Closed
@vudaltsov

Description

@vudaltsov
Issue body actions

Symfony version(s) affected

7.1.4

Description

In PHP 8.4 we'll have virtual properties and asymmetric visibility.

PropertyInfo considers the following properties writable, although they are not:

final class Foo
{
    public private(set) bool $public_private_set;
    public protected(set) bool $public_protected_set;
    public bool $virtual_no_set_hook { get => true; }
}

A side note. Many Symfony components optimistically state that they are compatible with all future PHP versions (for instance, the PropertyInfo component has "require": { "php": ">=8.2" } in its composer.json). However, this case shows that they are not and cannot be. I've discussed, whether it is a BC break on PHP's side or it isn't, see https://externals.io/message/125772. Symfony should probably reconsider it's PHP constraints.

How to reproduce

https://github.com/vudaltsov/symfony-property-access-php84

Possible Solution

In PHP 8.4 a property is writable if

   $reflectionProperty->isPublic()
&& !$reflectionProperty->isReadonly()
&& !$reflectionProperty->isPrivateSet()
&& !$reflectionProperty->isProtectedSet()
&& (!$reflectionProperty->isVirtual() || $reflectionProperty->hasHook(PropertyHookType::Set))

See https://externals.io/message/125740.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.