Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
D6 MySQL to D8.6.x PgSQL Migration
When using source plugin d6_taxonomy_vocabulary_per_type, if the Internationalization module was not enabled in D6 and there is no variable set 'i18ntaxonomy_vocabulary', the Migrate source outputs a harmless but noisy error.
In the Migrate source, prepareRow defaults $i17ntaxonomy_vocab to NULL if the variable is unset, then passes it to in_array.
We could either default it to an empty array (which handles the case of it being unset), or check the input with is_array() (which also handles cases where it's set to an unexpected value such as an integer).
Comment | File | Size | Author |
---|---|---|---|
#16 | interdiff-5-8.txt | 688 bytes | quietone |
#16 | 3025865-8.patch | 6.04 KB | quietone |
#8 | 3025865-8.patch | 6.04 KB | quietone |
#8 | interdiff-5-8.patch | 688 bytes | quietone |
#5 | interdiff.txt | 722 bytes | quietone |
Comments
Comment #2
xurizaemonInput checking (relaxed)
Comment #3
xurizaemonDefaulting to empty array (stricter, so my proposed fix).
Comment #4
quietone CreditAttribution: quietone as a volunteer commented@xurizaemon, thanks for the patch. I took a brief look and this looks good. Hope to do a proper review in the next couple of days.
Comment #5
quietone CreditAttribution: quietone as a volunteer commentedI was curious to know how d6 handles the i18ntaxonomy_vocabulary variable. The search found these
which clearly indicate that i18ntaxonomy is used in the d6 code as an array.
So, how is it used in D8 migration? Yes, it is used as an array and right in the source plugin, at line 40.
if (array_key_exists($vid, $i18ntaxonomy_vocab)) {
OK, time to update the source plugin test and prove the error. That's when I found there is no source plugin test. This patch add a source plugin for VocabularyPerType (added back in 2014) and the fix in #3. And a fail patch which is just the new test.
Comment #6
quietone CreditAttribution: quietone as a volunteer commentedA shorter, easier to read title.
Comment #8
quietone CreditAttribution: quietone as a volunteer commentedThe error in #5 the expected one,
array_key_exists() expects parameter 2 to be array, null given
This just corrects the summary line of the class.
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedComment #11
mikelutzLooks good.
Comment #13
quietone CreditAttribution: quietone as a volunteer commentedThe last patch, 3025865-8.patch, is passing tests, setting back to RTBC
Comment #15
mikelutzComment #16
quietone CreditAttribution: quietone as a volunteer commentedRe-uploading the patch from #8 to correct the misnaming of the interdiff and subsequent reports of test failures.
Comment #17
quietone CreditAttribution: quietone as a volunteer commentedOk, back to RTBC as set by mikelutz in #11. The report of failures since then were because of the wrongly named interdiff.
Comment #18
mikelutzAdding a test against 8.7. +1 RTBC on green.
Comment #19
quietone CreditAttribution: quietone as a volunteer commentedAh, right, let's make this 8.7.x then.
Comment #21
quietone CreditAttribution: quietone as a volunteer commentedTests are passing for 8.7.x, back to RTBC
Comment #22
knyshuk.vova CreditAttribution: knyshuk.vova at Internetdevels, Drupal Ukraine Community commented+1 to RTBC
Comment #23
Gábor HojtsyComment #26
Gábor HojtsyGood find, thanks!
Comment #27
Gábor Hojtsy