TypeError: preg_match() when user doesn't have edit access

Created on 20 February 2024, 10 months ago

1.0 Problem/Motivation

When a user has access to view webform submissions, but not edit or delete them, there is a fatal error on the 'Results' page:

TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in preg_match() (line 585 of /var/aegir/platforms/alumni-staging/sites/alumni.staging.drupal.uis.cam.ac.uk/modules/contrib/webform_civicrm/webform_civicrm.module).

This is because the data is in a property of an array, rather than a string, when they don't have edit access.

2.0 Detailed steps to reproduce (embed screenshots)

- Create a CiviCRM webform with some submissions
- Give another user submission view but not edit access
- As the other user, try to view the webform results

3.0 Proposed resolution

Pull out the string if we find an array format instead.

🐛 Bug report
Status

Needs review

Version

5.0

Component

Code

Created by

🇬🇧United Kingdom jkingsnorth

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

Comments & Activities

Production build 0.71.5 2024