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.
PHP message: PHP Fatal error: [] operator not supported for strings in sites/all/themes/mbase/includes/helper.inc on line 1577
Original code
$link['attributes']['class'][] = 'btn'; // row 1577 crashes due to not initialised as array
$link['attributes']['class'][] = 'btn-xs';
Quickfix
$link['attributes']['class'] = array($link['attributes']['class'],'btn');
$link['attributes']['class'][] = 'btn-xs';
Comment | File | Size | Author |
---|---|---|---|
#8 | mbase-2805647-8.patch | 1.19 KB | pifagor |
#3 | mbase-2805647-3.patch | 600 bytes | pifagor |
Comments
Comment #2
arne_hortell CreditAttribution: arne_hortell commentedIt also requires to check IF ['class'] exists...
Comment #3
pifagorimplemented in patch
Comment #4
pifagorComment #5
arne_hortell CreditAttribution: arne_hortell commented// with no check if 'class' exists it gives notice message...
// creates typecasting if $link['attributes']['class'] is defined but is a string
if (array_key_exists('class',$link['attributes']))
$link['attributes']['class'] = array($link['attributes']['class'],'btn');
else
$link['attributes'][] = array('class'=>'btn');
Comment #6
arne_hortell CreditAttribution: arne_hortell commentedMore fixinig needed for mbase
Row 78 and forward should be
function _mbase_smart_region(&$var, $regions, $theme) {
foreach ($regions as $region) {
$drupal_block=false; // added by me
if (array_key_exists($region,$var['page'])) // added by me
$drupal_block = $var['page'][$region];
// Display the block if it exists.
Comment #7
pifagor@arne_hortell thank you for the advice. New patch
Comment #8
pifagorFixed on coding standards