Improve handling of empty data

Created on 11 January 2023, almost 2 years ago
Updated 17 April 2023, over 1 year ago

Problem/Motivation

In many practical cases , especially coming from Feeds Tamper usage point of view, handling empty data (like string or array) wouldn't be different to handling NULL value. However strict data type checks in the plugins like

are making it hard to use this functionality .

Proposed resolution

Update mentioned , and possibly other , plugins to gracefully work with the empty or NULL value data.

Remaining tasks

  • Agree on proposed resolution
  • Patch
  • Review
  • Commit

User interface changes

None

API changes

None

Data model changes

None

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇳🇿New Zealand RoSk0 Wellington

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    416 pass, 5 fail
  • 🇳🇿New Zealand ericgsmith

    Just pushing a WIP - not sure I got all the tests.

    I think after working with feeds again after a long time - we should be doing this.

    I think skipping on empty should solve a lot of related issues.

    I suspect we might also want to add follow up issues to relax some of the strictness / casting in other plugins - but I think for now we should make sure we are being consistent and easier to use with empty data.

  • Status changed to Needs work over 1 year ago
  • 🇳🇿New Zealand ericgsmith

    Setting to needs work to cleanup test failures and coding standards

  • 🇳🇿New Zealand ericgsmith

    I was way too eager changing everything - a bit to revert / cleanup in the branch

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    459 pass
  • 🇳🇿New Zealand ericgsmith

    Alright, reverted my over eager changes.

    We would need additional tests to confirm this behaviour + document its intentions somewhere.

    Are we in agreement @MegaChriz on this approach?

    It might be a better idea for me to fix tests & commit the related issues first given I am sure on those issues, then come back to this parent issue to review implementing in the plugins I've changed here for consistency reasons. I'll try make the Friday feeds meetup to discuss.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • Status changed to Needs review over 1 year ago
  • 🇳🇿New Zealand ericgsmith

    I've update the MR with a bunch of tests, and tweaks to avoid calls to empty in situations where null is sufficient and safer.

    If I get time, it could do with some tests around some of these plugins.

    I'm also going to open a seperate issue as I was not sure if we should be removing the exception thrown in the Hash plugin.

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 7 months ago
    PHPLint Failed
  • Pipeline finished with Failed
    7 months ago
    Total: 163s
    #169508
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 7 months ago
    555 pass
  • Pipeline finished with Success
    7 months ago
    Total: 865s
    #169519
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 7 months ago
    579 pass
  • 🇯🇵Japan ptmkenny

    Added some more tests for empty strings and cleaned up the comment on the null value tests.

  • Pipeline finished with Success
    7 months ago
    Total: 846s
    #169543
  • Status changed to RTBC 6 months ago
  • 🇧🇷Brazil PabloNicolas

    I was unable to finish executing feeds-import because some data came in as NULL, triggering the exception and interrupting the batch import. I took the MR diff and applied it as a composer patch, it worked perfectly for me!

    Thank you!

  • 🇬🇧United Kingdom robcarr Perthshire, Scotland

    This worked well. Thanks for the patch.

    Worth noting that a related issue was down to bogus whitespace at the end of the file, just after the final closing tag. The XML parser didn't seem to like that either.

Production build 0.71.5 2024