I have now tried to debug on the node import module for about 2 days now and I can not fix the problem for importing taxonomy with parent items.

In the preview section I all the time get the following warning while trying to import taxonomy terms with parent a parent item:

warning: mb_strlen() expects parameter 1 to be string, array given in /var/vhosts/drupal/includes/unicode.inc on line 404.

I have located the problem to be triggered at line 682 while filtering an array of field-data with the drupal_strlen-function.

I have tried to level the arrays before passing it through drupal_strlen, that made the "Parent: " appear with the correct parent name and every thing, but when I import with that data, it results in an error at every line with the following error in the reject file:

An illegal choice has been detected. Please contact the site administrator.

I have tried many things now but the thing that came closest to a solution was to make a helper function for the drupal_strlen-function to handle sub array item, because the term parent item in a second level array and the drupal_strlen does not support that.

I therefore made the following function and let the array_filter at line 682 use that as a callback instead of drupal_strlen:

function _drupal_strlen($data) {
  if(isset($data[0])) {
    return drupal_strlen($data[0]) ? $data[0] : false; 
  }

  return drupal_strlen($data);
}

This function seem to handle the data except for multiple parents and "Parent: " now shows at the preview but with no data in it. (It is a test function ;) )

The fields know passes through drupal_strlen without any problems, but then I get the following warning:

warning: Illegal offset type in isset or empty in /home/web/vhosts/drupal-haan/sites/all/modules/node_import/supported/taxonomy.inc on line 152.
warning: Illegal offset type in isset or empty in /home/web/vhosts/drupal-haan/modules/taxonomy/taxonomy.module on line 1038.
warning: Illegal offset type in /home/web/vhosts/drupal-haan/modules/taxonomy/taxonomy.module on line 1039.
warning: Illegal offset type in /home/web/vhosts/drupal-haan/modules/taxonomy/taxonomy.module on line 1042.
warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/web/vhosts/drupal-haan/includes/bootstrap.inc on line 840.
warning: Illegal offset type in /home/web/vhosts/drupal-haan/sites/all/modules/node_import/supported/taxonomy.inc on line 160.
warning: Illegal offset type in /home/web/vhosts/drupal-haan/sites/all/modules/node_import/supported/taxonomy.inc on line 164.

And if I try to import the data anyway every import results in an error.

Comments

Korinvall’s picture

Subscribing