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.
Problem/Motivation
I tested creating a freeform text profile field in D6 and created 2 users that had content in the freeform text field, I tried to migrate the data to D8 and the data did not come across. The field name came across without any of the data, and it seems to have converted the profile field from free text, to an item list, and you can add new items as separate text fields. NOTE the problem does not occur if you in D6 separate list items by carriage return, but it does occur if you list your items in D6 using commas.
Proposed resolution
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#8 | interdiff.txt | 2.57 KB | ultimike |
#8 | freeform-2281627-8.patch | 3.71 KB | ultimike |
Comments
Comment #1
Barnettech CreditAttribution: Barnettech commentedComment #2
jjpost CreditAttribution: jjpost commentedComment #3
jjpost CreditAttribution: jjpost commentedThis patch makes sure the data splits on newlines and commas, fixing the issue. This patch includes updated test files.
Comment #4
ultimikeThe patch looks good to me - thanks for adding the additional tests!
-mike
Comment #5
benjy CreditAttribution: benjy commentedMissing full stop.
This regex looks a bit much? How about:
/[\r\n,]+/
from: http://stackoverflow.com/a/3483314
Comment #6
ultimikeBenjy,
That's a pretty little bit of RegEx that you found. Elegant solution.
I also beefed up the test a bit.
-mike
Comment #7
benjy CreditAttribution: benjy commentedDo we need just a \n on it's own?
Comment #8
ultimikeSounds like a good idea. Updated patch attached.
Thanks,
-mike
Comment #9
jjpost CreditAttribution: jjpost commentedI used that long regex so it would catch single \n and \r\n. Some operating systems still produce \n, some produce \r and most \r\n (some info here: http://stackoverflow.com/questions/13092837/does-n-r-behave-differently-...).
The original plan was to use PHP_EOL, but I dont know how to put that in a regex.
Just using \r\n might break in some cases, the patch in #3 searches for \r\n and after that for \r and \n, so it will work in all cases.
Comment #10
benjy CreditAttribution: benjy commentedAs mentioned on the call I think it might be worth moving some of the stuff in prepareRow() into a process plugin at some point but that shouldn't hold this issue up since we want people to keep testing their migrations and this fixes the issue.
Comment #11
benjy CreditAttribution: benjy commentedjjpost, the regex we have now searches for 1 or more of the characters in the regex so it handles the \n and \r cases as well as \r\n etc. This is shown by the tests still passing.
I don't think PHP_EOL would have worked since that is picked up from the current environment and that might be different from when the data was created.
Comment #12
jjpost CreditAttribution: jjpost commented@benjy You are right, patch #8 works perfectly. Thanks!
Comment #13
alexpottCommitted 5027a94 and pushed to 8.x. Thanks!