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.

CommentFileSizeAuthor
#2 parse-attrs-return-type-2914416-2.patch292 bytesvaish
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vaish created an issue. See original summary.

vaish’s picture

Status: Active » Needs review
FileSize
292 bytes

This 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().

  • Denes.Szabo committed 01f13ce on 7.x-2.x authored by vaish
    Issue #2914416 by vaish: _shortcode_parse_attrs() should always return...
Denes.Szabo’s picture

Status: Needs review » Fixed

@vaish thx!

Denes.Szabo’s picture

Status: Fixed » Closed (fixed)