Feeds/Tamper errors when last CSV value on last line is empty and there is no newline after it.

Created on 21 February 2020, about 5 years ago
Updated 6 December 2023, over 1 year ago

Thanks for a fantastic module :)

I'm not sure if this is a Feeds or Feeds Tamper issue, but I have a CSV feed with an strtotime tamper on the last value of each CSV line. When importing a CSV file with an empty value on the end of the last line of the file, I receive the following:
Drupal\tamper\Exception\TamperException: Input should be a string. in Drupal\tamper\Plugin\Tamper\StrToTime->tamper() (line 27 of /docroot/modules/contrib/tamper/src/Plugin/Tamper/StrToTime.php).

The CSV line in question is:
title,prod3,casual,20-06-2020,3-07-2020,16-07-2020,07-07-2020 1700,20-06-2020,3-07-2020,07-07-2020 1700,20-06-2020,3-07-2020,,,,

The last few values are empty because they are optional, which works fine for the rest of this CSV file and other CSV files. In this instance though, the import will fail unless an empty new line is added to the end of the file, looking like:

title,prod3,casual,20-06-2020,3-07-2020,16-07-2020,07-07-2020 1700,20-06-2020,3-07-2020,07-07-2020 1700,20-06-2020,3-07-2020,,,,

Other CSV files where there is a value at the end, do not require an empty new line.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇦🇺Australia jfarry Adelaide

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy kopeboy Milan

    I encountered a similar error today with Drupal\tamper\Exception\TamperException: Input should be a string. in Drupal\tamper\Plugin\Tamper\Explode->tamper() (line 72 of /var/www/html/web/modules/contrib/tamper/src/Plugin/Tamper/Explode.php).

    I was running the same feed type with same csv structure, so it should be a question of formatting the csv file or a null cell that I cleaned just today...
    The problem is hard to find cause even with feeds_log enabled there's nothing pointing to the line of the source "causing" the error 🫤
    ..and I solved it indirectly. Probably was due to a tampered item being empty.

  • 🇺🇸United States jimmynash

    I just wanted to note this here on this issue because it ended up being a simple workaround for us in a pinch:
    https://www.drupal.org/project/feeds_tamper/issues/2983197#comment-14954757 🐛 Catch TamperException to prevent import from crashing Needs review

Production build 0.71.5 2024