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

  1. Make sure your server is running PHP 8.2 or later, and that you're logging deprecation warnings
  2. Make sure ip2country is able to detect your IP address (i.e., your dev environment doesn't prevent IP detection)
  3. Navigate to the module's configuration form (`/admin/config/people/ip2country`)
  4. If necessary, uncheck "Admin debug" under "Debug preferences"
  5. Save configuration
  6. 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.

User interface changes

API changes

Data model changes

Comments

kwolford121 created an issue. See original summary.

kwolford121’s picture

Issue summary: View changes
kwolford121’s picture

Status: Active » Closed (duplicate)
Related issues: +#3476131: Error while saving the settings Form

Didn't notice earlier, but this has been pointed out in the related issue.