Batch process stuck with error: Argument #2 ($haystack) must be of type array, null given in array_search()

Created on 18 August 2023, over 1 year ago
Updated 27 August 2023, over 1 year ago

Problem/Motivation

After a migration from Drupal 7 to Drupal 10, when cloning an image field to an existing media field, the batch process doesn't run and produces this error:

TypeError: array_search(): Argument #2 ($haystack) must be of type array, null given in array_search() 

There are no stored hashes of image files, so $hashes returns null.

Proposed resolution

Provide an empty array as the default value for $hashes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇰🇪Kenya bigtings

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

Comments & Activities

Production build 0.71.5 2024