Method findChangedKeys in Arraydiff.php should check if both compared keys are arrays

Created on 20 February 2024, 10 months ago

Problem/Motivation

Sometimes old and new values do not necessarily have to be of the same type. When iterating to find the changes, you may want to keep iterating because the new values are an array, but the old value was a string. This happens especially in interactions between metatag modules, schema.org, and image type fields.

The error displayed is this:
TypeError: Drupal\log_entity_operations\ArrayDiff::diff(): Argument #1 ($old) must be of type array, string given, called in web/modules/contrib/log_entity_operations/src/ArrayDiff.php on line 88 in Drupal\log_entity_operations\ArrayDiff->diff() (line 28 of web/modules/contrib/log_entity_operations/src/ArrayDiff.php).

Proposed resolution

Check if the old value to be compared is an array too.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇪🇸Spain Juanjol Navarra

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024