Adding item to emtpty queue causes TypeError: array_column()

Created on 6 October 2023, about 1 year ago
Updated 10 October 2023, about 1 year ago

Problem/Motivation

On PHP 8+ when adding an item to an empty queue the following error will be thrown:

TypeError: array_column(): Argument #1 ($array) must be of type array, bool given in array_column() (line 121 of entityqueue/includes/entityqueue.admin.inc).

Steps to reproduce

Running a site using PHP 8, create a new node based queue and try adding an item using its edit form. The error will happen.

Proposed resolution

field_get_items() will return bool false when nothing is in the queue. Since array_column() expects the first value to be an array we must handle the bool false case by defaulting to an empty array instead of always calling array_column().

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom magicmyth

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

Comments & Activities

Production build 0.71.5 2024