craftcms/feed-me

Whitespace will not overwrite or clear a field value

Opened this issue · 0 comments

Description

If the source feed includes a value of a single space " ", the plain text field value will remain unchanged after processing the feed, irrespective of whether Set Empty Values is off or on. It seems to me that the single space should either be considered "a value" and replace the field value with " ", OR it should be considered "not a value" and in the case of Set Empty Values being ON, should clear the value of the field. But neither of these things appear to happen.

I haven't dug into the code, but my best guess is that the " " comes up false on an empty() check early on in the code, and thus doesn't qualify for the Set Empty Values special case, but perhaps later on down the line gets trim() applied and then fails an empty() check at that point (which maybe existed before the Set Empty Values functionality was added) and gets tossed out.

Edit: I was specifically using JSON to create ENTRIES

Additional info

  • Craft version: 4.13.5
  • PHP version: 8.2.0
  • Database driver & version: MySQL 5.7.39
  • Plugins & versions: Feed Me 5.9.0