Problem/Motivation
Dynamic properties are deprecated in PHP 8.2, but a dynamic property is set on an `AccountProxy` object when submitting the user location config form (`/admin/config/people/ip2country`).
Steps to reproduce
- Make sure your server is running PHP 8.2 or later, and that you're logging deprecation warnings
- Make sure ip2country is able to detect your IP address (i.e., your dev environment doesn't prevent IP detection)
- Navigate to the module's configuration form (`/admin/config/people/ip2country`)
- If necessary, uncheck "Admin debug" under "Debug preferences"
- Save configuration
- You should see a deprecation warning logged about creating the `country_iso_code_2` dynamic property
Proposed resolution
Modify the `submitForm` method in `/src/Form/Ip2CountrySettingsForm.php` (line 528 at the time of writing) to save the `country_iso_code_2` property to the `User` object instead of the `AccountProxy` object. If necessary, also modify other parts of the code that read this property to point to the `User` object instead.
(Note: this isn't a problem on 2.0.2 because that version saves to the `User` object, which has a magic `__set()` method that's called instead.)
Remaining tasks
Refactor code to avoid setting the dynamic property.
Comments
Comment #2
kwolford121 commentedComment #3
kwolford121 commentedDidn't notice earlier, but this has been pointed out in the related issue.