Problem/Motivation

The conditional statement in question is:

if ($item->target_id == $file->id() && $item->width != $width || $item->height != $new_height)

in the ImageResize.php from the QueueWorker
This condition mistakenly evaluates to true when $item->target_id is not equal to $file->id(), yet $item->height does not match new_height.
The expected behavior is for all checks to be associated with the condition where $item->target_id == $file->id().

Proposed resolution

To address this issue, the logical grouping in the conditional expression needs adjustment. The corrected version of the code should use parentheses to ensure the right order of evaluation:

if ($item->target_id == $file->id() && ($item->width != $width || $item->height != $new_height))

This adjustment will ensure that the width and height checks are only considered when the target ID actually matches.

Remaining tasks

Provide a MR

User interface changes

none

API changes

none

Data model changes

none

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

isaacrc created an issue. See original summary.

isaacrc’s picture

Assigned: isaacrc » Unassigned
Status: Active » Needs review

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

berdir’s picture

Status: Needs review » Fixed

Thanks, merging.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • berdir committed 2a71f4bd on 1.x authored by isaacrc
    fix: #3441498 Issue with conditional logic leading to incorrect...

Status: Fixed » Closed (fixed)

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