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.
Return value of _shortcode_parse_attrs() is defined as array. However in some cases function returns string instead of array (In my case it was always empty string). This can cause a problem because return value of this function is passed as first argument to "process callback" functions that are defined by hook_shortcode_info(). Such callbacks may also be defined by other modules and expect to always receive an array. Passing a string to such callback will produce "Illegal string offset" PHP warnings.
Comment | File | Size | Author |
---|---|---|---|
#2 | parse-attrs-return-type-2914416-2.patch | 292 bytes | vaish |
Comments
Comment #2
vaish CreditAttribution: vaish as a volunteer commentedThis patch standardizes return value to always be an array. I hope someone who is more familiar with the module can confirm this approach won't have any unintended side-effects. Patch also needs to be tested with other contrib modules that are implementing hook_shortcode_info().
Comment #4
Denes.Szabo CreditAttribution: Denes.Szabo as a volunteer commented@vaish thx!
Comment #5
Denes.Szabo CreditAttribution: Denes.Szabo as a volunteer commented