Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
migration system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Sep 2015 at 20:44 UTC
Updated:
17 Sep 2015 at 17:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
phenaproximaComment #3
phenaproximaComment #4
phenaproximaDue to quirks in the way properties are processed through their individual pipelines, it looks like d6_user needs no changes, but d7_user does.
Why?
In Drupal 6, {users}.picture is either going to be a string (file path) or NULL. But the value entering the process pipeline is never empty, because for Drupal 6 the user picture is looked up by user ID, and all migrated users will have non-empty IDs. If the Migration process plugin fails the lookup, it implicitly returns NULL, and that is the value the destination property receives. This causes no problems for the field system because NULL field values are harmlessly ignored.
In Drupal 7, however, {users}.picture is either a number (file ID) or NULL, and the file is looked up by its fid. If the fid is 0 -- which shouldn't happen under normal circumstances, but it does happen in the data I've been testing with -- the Migration process plugin throws a MigrateSkipProcessException, and the destination property is assigned its initial value of 0. This gets passed into the field system and causes fatal errors.
Comment #6
phenaproximaHere's a fail patch proving the problem -- the D7 MigrateUserTest dies with a fatal error.
Comment #7
phenaproxima...and this passes :)
Comment #11
mikeryanStumbled a bit here on how 0 caused the default_value of NULL to set, since in D7 migrate defaultValue() was only applied if the incoming value was NULL. But, D8 default_value is a little more flexible - by default (hah!) a 0 or empty string counts as "empty" and triggers the default_value, you can set strict: true to get the old behavior and only default when receiving NULL.
Looks good!
Comment #12
webchickCommitted and pushed to 8.0.x. Thanks!