• Resolved xenator

    (@xenator)


    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

    (@xenator)

    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 6 years, 6 months ago by xenator.
    Plugin Author Javier Carazo

    (@carazo)

    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.