Merge pull request #791 from mailpoet/first_last_names_fix

Fix MySQL strict mode error when saving a subscriber without first or…
This commit is contained in:
mrcasual
2017-01-18 20:14:42 -05:00
committed by GitHub

View File

@@ -485,6 +485,17 @@ class Subscriber extends Model {
unset($data['segments']);
}
// fields that must exist
$not_null_fields = array(
'first_name' => '',
'last_name' => ''
);
foreach($not_null_fields as $field => $value) {
if(!isset($data[$field])) {
$data[$field] = $value;
}
}
// custom fields
$custom_fields = array();
foreach($data as $key => $value) {