Closed (fixed)
Project:
Shortcode
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
31 Mar 2017 at 21:06 UTC
Updated:
18 Aug 2019 at 07:57 UTC
Jump to comment: Most recent
After I upgrade the php version form 5.5 to 7.1.3 I take a WSOD with message
Error: [] operator not supported for strings in shortcode_add_class()
(line 521 of ....../web/sites/all/modules/shortcode/shortcode.module).
After I patch the shortcode.module and add in line 521 the
+ $class = array();
Problem Solved...
Comments
Comment #2
tasoslo commentedComment #3
youfei.sun commentedFor the 8.x branch, the same modification can be put on to line 195,
...
+ $classes = array();
$classes[] = $new_class;
at file src/Plugin/ShortcodeBase.php
Comment #4
Tonkers commentedPlease include this fix for the next update of 7.x so our manual code revision won't be overridden. Just worried since it's been 6 months since the 7.x branch has been talked about. Thank you!
Comment #5
btweb commentedHello
since no update yet of module , can someone explain where to add this line ?
function shortcode_add_class($class = '', $default = '') {
if ($class) {
if (!is_array($class)) {
$class = explode(' ', $class);
}
array_unshift($class, $default);
$class = array_unique($class);
}
else {
$class[] = $default;
}
return implode(' ', $class);
}
Thanks
Comment #6
denes.szabo commentedComment #8
denes.szabo commentedThe Drupal 7 version fixed, just rolled out a new release 7.x-2.25.
I would appreciate if you could test this release with this bug.
I try to fix D8 version tomorrow.
Comment #10
denes.szabo commentedFixed. Would you mind to check it?
Comment #11
gmclelland commentedLooks like I'm still running into this error with 7.x-2.26. See #3014037: Error: [] operator not supported for strings in shortcode_add_class()
Anybody have any ideas for a fix?
Comment #12
gmclelland commentedSorry for the noise. It was an error on my part. Disregard my comment.
Comment #13
denes.szabo commentedComment #14
denes.szabo commentedComment #15
liam morlandComment #16
denes.szabo commented