Import CSV - SyntaxError: Unexpected token ( in JSON at position 1

By zip222 - October 16, 2018

I am getting an error when attempting to import a CSV file using the CSV import plugin. 

  • "Status: Error: There was an error sending the request! (200 OK) parsererror - SyntaxError: Unexpected token ( in JSON at position 1"
  • CMSB 3.14
  • CSV Import 1.11
  • It works totally fine on the dev server, but errors out on the live server.

By zip222 - October 16, 2018

  • At what point in the CSV import process do you see this error?

Import CSV = ok

Upload file = ok

Select target table = ok

Analyze Data = error

Do any errors show up in the Developer Log (under Admin Menu in CMSB) when you attempt the import?

Yes...

Error:
E_WARNING: count(): Parameter must be an array or an object that implements Countable

URL: 
/cmsb/admin.php?_plugin=csvImport_v111/csvImport_functions.php&_pluginAction=csvImport_analyseForm_ajax&num=19&offset=0&rowNum=1&menu

Filepath:
/var/www/html/cmsb/plugins/csvImport_v111/csvImport_functions.php

Line num
500

Backtrace
#0 _errorlog_logErrorRecord() called at [/var/www/html/cmsb/lib/errorlog_functions.php:64]
#1 _errorlog_catchRuntimeErrors() called at [/var/www/html/cmsb/plugins/csvImport_v111/csvImport_functions.php:500]
#2 csvImport_analyseForm_ajax() called at [/var/www/html/cmsb/plugins/csvImport_v111/csvImport.php:105]
#3 csvImport_init() called at [/var/www/html/cmsb/lib/plugin_functions.php:312]
#4 doAction() called at [/var/www/html/cmsb/admin.php:32]

By daniel - October 16, 2018

Hello,

It looks likely that there's a difference in PHP version between your dev and live servers; that error shows up only in PHP 7.2+, so I'd guess that your live server is running a newer version. The latest version of the CSV Import plugin (https://www.interactivetools.com/add-ons/csv-import/) has been updated to fix the error - my recommendation would be to update the plugin.

Let me know any other questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

By zip222 - October 16, 2018

That solved it. Thanks!