AJAX error when adding more items to multi-value fields

Created on 24 December 2023, 11 months ago

Problem/Motivation

When creating or editing coupons, adding additional items to multi-value fields, like Applicable Products, results in an AJAX error:

ResponseText: TypeError: array_walk(): Argument #1 ($array) must be of type array, null given in array_walk() (line 1063 of /app/ sites/all/modules/uc_coupon/uc_coupon.admin.inc).

Steps to reproduce

Using Drupal 7.99 and PHP 8,1, create a new coupon and click "Add more items" under Applicable Products.

Proposed resolution

This patch ensures all multi-value fields in $form data are initialized with an empty array to array_walk and array_filter do not throw errors.

πŸ› Bug report
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States noahott

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

Comments & Activities

Production build 0.71.5 2024