Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setEmptyValues causing DataHelper Error when off #1269

Closed
alexrubin opened this issue Mar 31, 2023 · 1 comment
Closed

setEmptyValues causing DataHelper Error when off #1269

alexrubin opened this issue Mar 31, 2023 · 1 comment
Assignees

Comments

@alexrubin
Copy link

Craft CMS: v4.4.5
FeedMe: v5.1.1.1

I'm receiving an error in the FeedMe logs: "Trying to access array offset on value of type null - DataHelper.php: 182" while trying to import a value that's "" (empty) while having setEmptyValues set to off for the Feed.

if ($value === "" && $feed['setEmptyValues']) {

// If setEmptyValues is enabled allow overwriting existing data
if ($feed !== null && $value === "" && $feed['setEmptyValues']) {
    return $value;
}

// If setEmptyValues is enabled allow overwriting existing data
if ($value === "" && $feed['setEmptyValues']) {
    return $value;
}

The following change resolved my import issue, though I don't have enough test data to confirm if there were unexpected cascading effects: (updated both conditionals since they both reference setEmptyValues though only 182 was needed to fix my import issue)

// If setEmptyValues is enabled allow overwriting existing data
if ($feed !== null && $value === "" && isset($feed['setEmptyValues']) && $feed['setEmptyValues']) {
    return $value;
}

// If setEmptyValues is enabled allow overwriting existing data
if ($value === "" && isset($feed['setEmptyValues']) && $feed['setEmptyValues']) {
    return $value;
}
@i-just i-just self-assigned this Apr 3, 2023
@angrybrad
Copy link
Member

Thanks for the report! Resolved in ee9237f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants