File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
app/code/Magento/ImportExport/Model/ResourceModel/Import Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -159,9 +159,17 @@ public function getNextBunch()
159
159
*/
160
160
public function saveBunch ($ entity , $ behavior , array $ data )
161
161
{
162
+ $ encodedData = $ this ->jsonHelper ->jsonEncode ($ data );
163
+
164
+ if (json_last_error ()!==JSON_ERROR_NONE && empty ($ encodedData )) {
165
+ throw new \Magento \Framework \Exception \ValidatorException (
166
+ __ ('Error in CSV: ' . json_last_error_msg ())
167
+ );
168
+ }
169
+
162
170
return $ this ->getConnection ()->insert (
163
171
$ this ->getMainTable (),
164
- ['behavior ' => $ behavior , 'entity ' => $ entity , 'data ' => $ this -> jsonHelper -> jsonEncode ( $ data ) ]
172
+ ['behavior ' => $ behavior , 'entity ' => $ entity , 'data ' => $ encodedData ]
165
173
);
166
174
}
167
175
}
You can’t perform that action at this time.
0 commit comments