I have a migration pulling in data from an XML document into a fresh Drupal 6 setup.
However, if I attempt to set a filter format for the body field I get these errors for each attempted import:
strpos() expects parameter 1 to be string, array given
File node/node.module, line 314
The configuration for the filter format looks like so:
$this->addFieldMapping('body', 'description')
->arguments(array('format' => 'full_html'))
->xpath('description');
I've traced part of the bug down to the function node_teaser
being passed incorrect parameters, whereby the first paramter $body
is actually an array. I can step around this issue by changing line 200 in migrate/plugins/destination/node.inc to
$node->teaser = node_teaser($node->body[0]);
but this then causes a different error which I haven't attempted to debug further:
mysqli_real_escape_string() expects parameter 2 to be string, array given File includes/database.mysqli.inc, line 329
I'm happy to help debug further, please just let me know what information I can provide.
Comments
Comment #1
torrance123 CreditAttribution: torrance123 commentedAlso, I note at least one other person has reported the same issue: http://drupal.org/node/1174442#comment-5092820
Comment #2
torrance123 CreditAttribution: torrance123 commentedAlso, if it's of any help, I have no 'body' field listed in the UI in the list of destination fields — this applies to both the default 'Story' and 'Page' content types as well as a custom type. Things are mostly pretty vanilla.
I can import into the body field just fine, however, so long as I don't set a text format filter on it, though migrate does complain that ""body" was used as destination field in "description" mapping but is not in list of destination fields".
Comment #3
mikeryanThe body and teaser got lost from the list of available fields when the subfield support was added, I've put them back.
As for the format - in Drupal 6 there was no machine name for text formats (i.e., "full_html" has no meaning), you need to use the numeric ID from the filter_formats table.
Comment #4
Alex Andrascu CreditAttribution: Alex Andrascu commentedCan you please provide an example:
where 2 is full_html, does the same thing.
Thanks
Comment #5
Alex Andrascu CreditAttribution: Alex Andrascu commentedComment #6
mikeryanLike body and teaser, format got lost from the list of node fields - on D6, format is a node field, not a subfield of the body.
Map as follows on D6:
Comment #7
Alex Andrascu CreditAttribution: Alex Andrascu commentedright *slaps self* thanks a lot :)
Comment #8.0
(not verified) CreditAttribution: commentedFormatting correction
Comment #9
Chris CharltonI got stung by this in a D7-to-D7 migration. No resolution yet.