Running Drupal 4.7.6
After upgrading from 4.7.x-2.1 to 4.7.x-3.0-rc1, and running update.php without error, went to administer > settings > flexicharge and got the following fatal error:
Fatal error: Cannot use string offset as an array in /hsphere/local/home/(redacted for privacy)/modules/system.module on line 748
Line 748 on my system module reads:
$form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
Essentially adding the submit reset buttons to a form.
The warnings logged read:
* warning: Missing argument 2 for system_settings_form(), called in /hsphere/local/home/(redacted for privacy)/modules/ecommerce/contrib/flexicharge/flexicharge.module on line 70 and defined in /hsphere/local/home/(redacted for privacy)/modules/system.module on line 747.
* warning: htmlspecialchars() expects parameter 1 to be string, array given in /hsphere/local/home/(redacted for privacy)/includes/bootstrap.inc on line 609.
Which is this:
function flexicharge_settings() {
$form = array();
$form['flexicharge']['taxonomy'] = array(
'#type' => 'checkbox',
'#title' => t('debug mode (watchdog)'),
'#description' => t('Please choose a category list to be used by flexicharge.'),
'#default_value' => variable_get('eyedrop_debugging_mode', FALSE),
);
return system_settings_form($form);
}
Which I think needs to look like this:
function flexicharge_settings() {
$form = array();
$form['flexicharge']['taxonomy'] = array(
'#type' => 'checkbox',
'#title' => t('debug mode (watchdog)'),
'#description' => t('Please choose a category list to be used by flexicharge.'),
'#default_value' => variable_get('eyedrop_debugging_mode', FALSE),
);
//Add the form ID
return system_settings_form('flexicharge_settings', $form);
}
Comments
Comment #1
gordon commentedThanks this has now been fixed.
Comment #2
(not verified) commentedComment #3
Anonymous (not verified) commentedI got the exact same error updating to 3.0 from 2.1.
However, the fix mentioned above is already present in the code. Any ideas?
Comment #4
feliz commentedIt is necessary to return the $form itself instead of the html generated by system_settings_form().
system_settings_form() is called on the form by system_site_settings() (system.module) after the flexicharge_settings() hook is called.
The code in flexicharge.module should look like:
Comment #5
brmassa commentedon EC4 the function doesnt exist anymore
Comment #6
(not verified) commented