Title: Uncaught Error while importing users
Last modified: August 23, 2018

---

# Uncaught Error while importing users

 *  Resolved [xenator](https://wordpress.org/support/users/xenator/)
 * (@xenator)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/uncaught-error-while-importing-users/)
 * Hi!
 * When I import users via cron and trigger the cron via curl, I get the following
   error:
 * <b>Fatal error</b>: Uncaught Error: [] operator not supported for strings in /
   usr/local/httpd/lvbb.bdmp.de/htdocs/wp-content/plugins/import-users-from-csv-
   with-meta/importer.php:337
    Stack trace: #0 /usr/local/httpd/lvbb.bdmp.de/htdocs/
   wp-content/plugins/import-users-from-csv-with-meta/import-users-from-csv-with-
   meta.php(320): acui_import_users(‘/usr/local/http…’, Array, 0, true, false) #
   1 /usr/local/httpd/lvbb.bdmp.de/htdocs/wp-content/plugins/import-users-from-csv-
   with-meta/import-users-from-csv-with-meta.php(502): acui_fileupload_process(Array,
   true) #2 /usr/local/httpd/lvbb.bdmp.de/htdocs/wp-includes/class-wp-hook.php(286):
   acui_cron_process() #3 /usr/local/httpd/lvbb.bdmp.de/htdocs/wp-includes/class-
   wp-hook.php(310): WP_Hook->apply_filters(”, Array) #4 /usr/local/httpd/lvbb.bdmp.
   de/htdocs/wp-includes/plugin.php(515): WP_Hook->do_action(Array) #5 /usr/local/
   httpd/lvbb.bdmp.de/htdocs/wp-cron.php(126): do_action_ref_array(‘acui_cron_proce…’,
   Array) #6 {main} thrown in <b>/usr/local/httpd/lvbb.bdmp.de/htdocs/wp-content/
   plugins/import-users-from-csv-with-meta/importer.php</b> on line <b>337</b><br/
   >
 * It seems there is problem in the importer.php, but I have no clue how to fix 
   this.
 * Thanks and regards
    Sebastian

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [xenator](https://wordpress.org/support/users/xenator/)
 * (@xenator)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/uncaught-error-while-importing-users/#post-10618130)
 * Ok I’ve found the problem 🙂
 * In importer.php you’re “initializing” the role variable with an empty string:
   
   $role = “”; (line 178).
 * But later on in line 337 you’re using [] to add the first element hence use it
   like an array. This does not work:
 * $role[] = $role;
 * This leads to an exception on PHP7.x (I guess it should also in earlier versions
   of PHP?)
 * Use $role = array(); instead of $role = “”; and it works just fine!
 * Regards
    Sebastian
    -  This reply was modified 7 years, 9 months ago by [xenator](https://wordpress.org/support/users/xenator/).
 *  Plugin Author [Javier Carazo](https://wordpress.org/support/users/carazo/)
 * (@carazo)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/uncaught-error-while-importing-users/#post-10620227)
 * Thanks for reporting this bug.
 * I have just fixed it and added to a new version.
 *     ```
       if( !is_array( $role ) ){
       										$role_tmp = $role;
       										$role = array();
       										$role[] = $role_tmp;
       									}
       ```
   
 * I have mentioned this thread in the readme.
 * Thanks for being such a good user 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Uncaught Error while importing users’ is closed to new replies.

 * ![](https://ps.w.org/import-users-from-csv-with-meta/assets/icon-256x256.png?
   rev=1174343)
 * [Import and export users and customers](https://wordpress.org/plugins/import-users-from-csv-with-meta/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/import-users-from-csv-with-meta/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/import-users-from-csv-with-meta/)
 * [Active Topics](https://wordpress.org/support/plugin/import-users-from-csv-with-meta/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/import-users-from-csv-with-meta/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/import-users-from-csv-with-meta/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Javier Carazo](https://wordpress.org/support/users/carazo/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/uncaught-error-while-importing-users/#post-10620227)
 * Status: resolved