Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The webform handler tokens will attempt to substitute with any value type as a string, including arrays, as long as the key exists in the response data array.
See https://git.drupalcode.org/project/webform/-/blob/c88d021ce517daab0adf1b...
The result of referencing an array is a PHP notice and the string "Array" being returned by the token.
Proposed resolution
Add a simple is_string
check for $value
in the ternary:
See https://git.drupalcode.org/project/webform/-/blob/c88d021ce517daab0adf1b...
This will allow the use of token facilities for empty strings (e.g. [webform:handler:remote_post:completed:foo:clear]
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#2 | webform-3135006-2.patch | 5.89 KB | bighappyface |
|
Comments
Comment #2
bighappyface CreditAttribution: bighappyface at Rackspace commentedI decided to use
is_scalar
instead to better-handle other types (e.g. integers) that can be easily coerced to strings.Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House for Memorial Sloan Kettering Cancer Center commentedPatch looks good. Thanks.
Comment #5
bighappyface CreditAttribution: bighappyface at Rackspace commented