Comparison of checkbox fields provides false differences

Created on 18 January 2023, over 2 years ago
Updated 18 May 2023, almost 2 years ago

Problem/Motivation

This modules does a strict comparison on field values to check for changes. While this works fine for fields that have string values in them, this is a problem with fields that have integers or booleans. This is due to the fact that Drupal loads all fields from the database as strings, so if a value changes in the current context that is a boolean, integer, float (or any other non-string value), then the strict comparsion returns true and logs a change.

Steps to reproduce

  • Install module
  • Add checkbox field to the user entity
  • Mark that checkbox field to be tracked by user_history
  • Save the user profile without changing the checkbox value

Proposed resolution

We should change all scalar values to strings before doing a strict comparison.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States j_ten_man

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024