So I have a custom plugin that inserts data from a csv. I build up the array of data and then issue the insert command.
Right before the insert I am dumping my array so I can see the values which are not encoded. This is what is displayed.
array(6) {
["entry_id"]=>
string(4) "2642"
["site_id"]=>
int(1)
["channel_id"]=>
int(1)
["field_ft_5"]=>
string(4) "none"
["field_id_5"]=>
string(28) "17524.mp4"
["field_ft_6"]=>
string(4) "none"
["field_id_6"]=>
string(3) "30"
}
Then the exception shows the sql query that is built out and this is what the query looks like.
INSERT INTO `exp_channel_data`
(`entry_id`, `site_id`, `channel_id`, `field_ft_5`, `field_id_5`, `field_ft_6`, `field_id_6`)
VALUES
('2642', 1, 1, 'none', '1\07\05\02\04\0.\0m\0p\04', 'none', '3\00')
//
My code is right there is. Nothing in between my dump and my insert. I have done something similar to this in the past and never saw anything get encoded.
var_dump($channel_data);
$this->EE->db->insert('channel_data', $channel_data);
Any tips on where to look would be appreciated. I am on EE 3.5.6 with php 7.2.
Thanks
Edit 1 Here is what I am doing to build the array so I am not converting object to array that I am aware of.
// exp_channel_data
$channel_data = array(
'entry_id' => $entry_id,
'site_id' => $this->_site_id,
'channel_id' => $this->_clip_channel_id
);
foreach($this->_clip_channel_fields as $clip_channel_field)
{
if( isset($clip_channel_field['field_name']) )
{
$field_id = 'field_id_' . $clip_channel_field['field_id'];
$field_ft = 'field_ft_' . $clip_channel_field['field_id'];
$channel_data[$field_ft] = $clip_channel_field['field_fmt'];
$channel_data[$field_id] = ${$clip_channel_field['field_name']};
}
}