Closed (duplicate)
Project:
Drupal core
Version:
8.9.x-dev
Component:
migration system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 May 2017 at 09:12 UTC
Updated:
5 Nov 2021 at 17:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
fonski commentedHere is a simple patch that skip null values.
Comment #4
quietone commentedThe iterator plugin is now the SubProcess plugin.
Comment #5
quietone commentedReplaced deprecated name with current name in the title
Comment #6
jofitzYou know I can't resist a reroll!
This will also need test(s) which I will look at now, but let's push this past the testbot first.
Comment #7
jofitzAdded a test. No interdiff because the only change is in the test_only patch.
Comment #9
heddnIs this the right thing though? It looks like Row accepts an empty array, so maybe a better fix is to check for non-array and cast to array? I'm not sure. But GIGO is maybe a valid option here.
Comment #10
jofitz@heddn If non-array values are converted to an empty array then the code can continue, but returns an additional array entry:
[NULL => NULL]which is undesired, so I have stuck withcontinuewithin the new conditional. An alternative would be to surround$return[$key] = $destination;withif (!is_null($key)). Any preference? Or is this issue irrelevant and not worth any more of my time.Comment #11
phenaproximaI like the idea here, but I don't think we should silently continue the loop if the value is not an array. At the very least, we should log a message in the migration's message table, or skip the processing (MigrateSkipProcessException) -- something more verbose than a silent skip.
Comment #14
ezeedub commentedRe-roll for 8.7
Comment #15
mikelutzThe documentation for sub_proces specifically says that it's expected input is an array of associative arrays. If there is a non-array value in the outer array, then there is a problem with the calling code that needs to be addressed. We should not simply skip past elements that do not meet this criteria. If we do anything here, we should throw a skip process or skip row exception with a message indicating the invalid input.
Anyone executing a custom migration that requires gracefully ignoring null rows should implement their own sub_process plugin that handles it, we shouldn't quietly ignore bad inputs in core.
Comment #16
mikelutzComment #17
heddnLet's add a skip row exception instead of just continuing.
Comment #20
mikelutzClosing this as a duplicate of #3048464: SubProcess migrate process plugin should throw exception on invalid input. This issue is older, but that issue is further along and more comprehensive.