Problem/Motivation

When the source is an empty array, no Tamper plugins are applied for that source. This is for example an issue when using the JSON parser, defining a custom source that does not appear in the JSON file and trying to apply the hash Tamper plugin on a source.

The reason why this happens is that whenever Feeds Tamper receives an array, it thinks it deals with a multivalue source and will try to iterate over it. Iterating over an empty array thus results that no Tamper plugins get applied.

Proposed resolution

When the value is an array, also check if it is empty.

Comments

MegaChriz created an issue. See original summary.

megachriz’s picture

Status: Active » Needs work
Issue tags: +Needs tests
StatusFileSize
new608 bytes

Here is a patch that could fix the issue. This will need an automated test.

megachriz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.19 KB
new1.78 KB

Writing this test seemed much easier than I thought!

The last submitted patch, 3: feeds_tamper-empty-array-2997310-3-tests-only.patch, failed testing. View results

  • MegaChriz committed 07e3a1d on 8.x-2.x
    Issue #2997310 by MegaChriz: Fixed no tamper plugins applied on an empty...
megachriz’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Tests fail for the test only patch and pass with the fix. Committed #3.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.