Download & Extend

Undefined variable: node in _content_migrate_batch_process_migrate_data

Project:Content Construction Kit (CCK)
Version:7.x-2.x-dev
Component:upgrade path
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

line 358 of .../sites/all/modules/cck/modules/content_migrate/includes/content_migrate.admin.inc

in checking my System log, I noticed a bunch of these errors. $node is referenced on line 358, but I don't see it set until later in this function

Comments

#1

Project:Migrate» Content Construction Kit (CCK)
Version:7.x-2.4» 7.x-2.x-dev
Component:Code» upgrade path

Moving to the right project.

#2

can reproduce: sample:

Processing through nid 1904
Undefined variable: node content_migrate.admin.inc:358
Undefined index: value content_migrate.admin.inc:370

Believe it or not: code line 358 is:
$query->addExpression("'". $node['type'] ."'", 'bundle');
but no $code variable exist in the context.

line 370:

foreach ($context['sandbox']['old_cols'] as $column_name => $db_column_name) {
    $query->addField('old_table', $db_column_name, $context['sandbox']['new_cols'][$column_name]);
  }

#3

[edit: pointless]

#4

the second notice (line 370) happens with:

$column_name = "value"
$context['sandbox']['new_cols'] = array(1) { 'tid' => string(16) "field_taxo_tid" }

content_taxonomy related ??

and also happens with:

$column_name = "data"
$context['sandbox']['new_cols'] = array {
  'fid' =>
  string(13) "field_mp3_fid"
  'display' =>
  string(17) "field_mp3_display"
  'description' =>
  string(21) "field_mp3_description"
}

and

$column_name = "list"
$context['sandbox']['new_cols'] = array {
  'fid' =>
  string(25) "field_myarticleCT_image_fid"
  'alt' =>
  string(25) "field_myarticleCT_image_alt"
  'title' =>
  string(27) "field_myarticleCT_image_title"
  'width' =>
  string(27) "field_myarticleCT_image_width"
  'height' =>
  string(28) "field_myarticleCT_image_height"

...

#5

I was having this problem (line 358, not 370) as well and I went to an old site that I converted and migrated a year ago. I found that the following few lines were in the CCK on that site but are missing on the current one:

$node = array_shift($context['sandbox']['nodes']);
  if (!$node) {
    return;
  }

Adding that in just after the // Process 100 nodes in each batch. comment on line 347 fixed it.

#6

In case anyone is wondering where to add that code, it goes into modules/cck/modules/content_migrate/includes/content_migrate.admin.inc