Dynamic properties are deprecated in PHP 8.2

Created on 14 November 2023, 12 months ago

Problem/Motivation

In PHP 8.2, dynamic properties are deprecated. Several classes in Migrate do not declare all the properties that can be created on them.

Steps to reproduce

  1. Install the latest version of Migrate on a Drupal 7 site.
  2. Set up a Migrate source based on CSV files.
  3. Run the migration.
  4. Note the PHP warnings in the log:
Creation of dynamic property MigrateSourceCSV::$options is deprecated in MigrateSourceCSV->__construct() (line 288 of /migrate/plugins/sources/csv.inc).
Creation of dynamic property MigrateSourceCSV::$csvcolumns is deprecated in MigrateSourceCSV->__construct() (line 321 of /migrate/plugins/sources/csv.inc).

Proposed resolution

Add the annotation to allow dynamic properties to these classes. Another solution would be to declare all the properties in the class.

There may be more classes or properties identified at runtime; these are just the ones I found when installing a distribution that uses a Migrate CSV source to generate starter content.

Remaining tasks

Patch and test.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cboyden

Live updates comments and jobs are added and updated live.
  • PHP 8.2

    The issue particularly affects sites running on PHP version 8.2.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024