Creating a new variable error: General error: 1364 Field 'variable_data' doesn't have a default value
When creating a new variable, if no variable data is provided, an error is generated:
SQLSTATE[HY000]: General error: 1364 Field 'variable_data' doesn't have a default value:
INSERT INTO 'exp_global_variables' ('variable_name') VALUES ('Test')
The solution I found (and I’m sure there may be something more elegant than this) is to insert the following on line 100 (before the list function) on low_variables_variable_model.php
if (! isset($data['variable_data'])) {
$data['variable_data'] = '';
}
This is likely happening because my test MySQL environment runs in strict mode, which catches errors that otherwise would not be caught.
Replies
Low 6 Mar 2016 10:52
Yeah, there is a slightly more elegant way of doing that. ;)
Have made a change to always set the variable_data when creating a var. Will be included in the next version.
I take it this is all v3.0.1, no?
TJ Draper 7 Mar 2016 14:22
Was 3.0.1, yes. Fixed in 3.0.2.