While importing a CSV in a clean drupal install the following error is thrown:
Fatal error: 'break' not in the 'loop' or 'switch' context in /var/www/html/sites/all/modules/contrib/taxonomy_csv/import/taxonomy_csv.import.line.api.inc on line 377
// Import term then store result.
$current_result = taxonomy_csv_term_import($term, $options['update_or_ignore']);
if (_taxonomy_csv_line_result($result, $current_result, $terms_count)) {
break;
}
fix:
// Import term then store result.
$current_result = taxonomy_csv_term_import($term, $options['update_or_ignore']);
if (_taxonomy_csv_line_result($result, $current_result, $terms_count)) {
return;
}
issue:
on PHP 7 break; cant be used outside of for, foreach or switch
Comments
Comment #2
corentin.crouvisier commentedSame issue for me.
Proposed patch works.
Comment #3
sudishth commentedI was fixed it please review
Comment #4
salvadorweb89 commentedThanks, it works great
Comment #5
parisekI can confirm, that proposed patch works
Comment #6
jpoesen commentedConfirming this patch works perfectly.
Comment #7
amazingrandoFWIW this patch worked for me.
Comment #8
dasha_v commentedAdded php7 tag.
Comment #9
hunlaprovo commentedThanks!!! I also have 7 on php on the server. Repair is good.
Comment #10
laxman.ghavte commented#3 patch worked for me.
Comment #11
elusivemind commentedThis is pretty much a duplicate of this and needs to be fixed consistently for the same reasons outlined there.
https://www.drupal.org/project/taxonomy_csv/issues/2824032
Comment #12
elusivemind commentedNew patch with new error checking logic that ensures the return of some data even if no translations.
Comment #13
elusivemind commentedComment #14
gdaw commentedPatch 12 worked great for me. RTBC +1
Comment #15
avpadernoComment #16
ethomas08 commentedRe-rolled patch from #12 for use with 7.x-5.11 module release.
Comment #17
ethomas08 commentedActually scratch that it looks like the newest module release no longer includes that break command. Patch no longer necessary?