Typing bug in RemotePostWebformHandler::remotePost

Created on 5 June 2023, about 1 year ago
Updated 30 January 2024, 5 months ago

Problem/Motivation

Just got tripped up by a typing bug located here:

https://git.drupalcode.org/project/webform_api_handler/-/blob/8.x-1.x/sr...

The problem appears to be an order of operations issue, at least within PHP 8.1. When calling if ($plugin = $this->configuration['response_plugin'] && !empty($response)) {, and we have both $this->configuration['response_plugin'] and a valid response, $plugin actually resolves to 1. This means that the plugin instance can't be created, unless it has the internal id 1.

Steps to reproduce

  1. Set up a handler with response plugin pointing to a valid URL
  2. Run a valid request.

Proposed resolution

A minor refactor to resolve any ambiguities, that should be compatible with other versions of PHP.

Remaining tasks

  1. Do the refactor

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia geoffreyr

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024