Problem/Motivation

In PHP 8.2, dynamic properties are deprecated. At least one class in Diff does not declare all the properties that can be created on its instances.

Steps to reproduce

  1. Install a Drupal 7 site on PHP 8.2.
  2. Download and enable the latest versions of Diff, Features, and Features UI submodule.
  3. Create a Feature and enable it.
  4. Override some of the configuration controlled by the Feature.
  5. Visit the "Review overrides" tab to see a diff of the Feature.
  6. Note the following PHP warnings:
Deprecated function: Creation of dynamic property _DiffEngine::$ychanged is deprecated in _DiffEngine->diff() (line 145 of /diff/DiffEngine.php).
Deprecated function: Creation of dynamic property _DiffEngine::$xchanged is deprecated in _DiffEngine->diff() (line 145 of /diff/DiffEngine.php).
Deprecated function: Creation of dynamic property _DiffEngine::$yv is deprecated in _DiffEngine->diff() (line 146 of /diff/DiffEngine.php).
Deprecated function: Creation of dynamic property _DiffEngine::$xv is deprecated in _DiffEngine->diff() (line 146 of /diff/DiffEngine.php).
Deprecated function: Creation of dynamic property _DiffEngine::$yind is deprecated in _DiffEngine->diff() (line 147 of /diff/DiffEngine.php).
Deprecated function: Creation of dynamic property _DiffEngine::$xind is deprecated in _DiffEngine->diff() (line 147 of /diff/DiffEngine.php).
Deprecated function: Creation of dynamic property _DiffEngine::$lcs is deprecated in _DiffEngine->_diag() (line 293 of /diff/DiffEngine.php).
Deprecated function: Creation of dynamic property _DiffEngine::$seq is deprecated in _DiffEngine->_diag() (line 294 of /diff/DiffEngine.php).
Deprecated function: Creation of dynamic property _DiffEngine::$in_seq is deprecated in _DiffEngine->_diag() (line 295 of /diff/DiffEngine.php).

Proposed resolution

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

Remaining tasks

Patch and test.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork diff-3403245

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

cboyden created an issue. See original summary.

cboyden’s picture

Assigned: cboyden » Unassigned
Status: Active » Needs review
StatusFileSize
new327 bytes

Patch is attached.

keshavv made their first commit to this issue’s fork.

michelle’s picture

StatusFileSize
new580 bytes

Added the fix to another class that needs it.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Yes this helped, thank you both

heddn’s picture

Status: Reviewed & tested by the community » Fixed

Commited #9. Thanks for your contributions.

  • heddn committed e82043de on 7.x-3.x
    Issue #3403245 by cboyden, michelle, joelpittet, heddn: Dynamic...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.