Skip to content

[PropertyAccess] PropertyAccess is not compatible with PHP 8.4 property hooks #59183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vudaltsov opened this issue Dec 11, 2024 · 0 comments
Closed

Comments

@vudaltsov
Copy link
Contributor

vudaltsov commented Dec 11, 2024

Symfony version(s) affected

7.2.0

Description

In PHP 8.4 we have virtual properties and asymmetric visibility.

PropertyAccess 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; }
}

The issue has already been fixed for the PropertyInfo component in #58556 via 520e31b. However, PropertyAccess is still not working correctly, see my reproducer (I've updated it to 7.2.x).

How to reproduce

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

Possible Solution

No response

Additional Context

No response

@vudaltsov vudaltsov added the Bug label Dec 11, 2024
fabpot added a commit that referenced this issue Jan 4, 2025
… visibility (Florian-Merle)

This PR was merged into the 6.4 branch.

Discussion
----------

[PropertyAccess] Fix compatibility with PHP 8.4 asymmetric visibility

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #59183
| License       | MIT

Fix compatibility with PHP 8.4 asymmetric visibility by looking if the setter hook is public.

Commits
-------

dd54b76 [PropertyAccess] Fix compatibility with PHP 8.4 asymmetric visibility
@fabpot fabpot closed this as completed Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants