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

preg_match() type error when setting default for asset field #1195

Closed
siffring opened this issue Oct 19, 2022 · 6 comments
Closed

preg_match() type error when setting default for asset field #1195

siffring opened this issue Oct 19, 2022 · 6 comments
Assignees
Labels

Comments

@siffring
Copy link

siffring commented Oct 19, 2022

Description

When running an entry import that has a default asset set for an asset field I get this error:

**preg_match(): Argument #2 ($subject) must be of type string, array given**

It's from line 133 of feed-me/src/fields/Assets.php

Steps to reproduce

  1. Set a default file for an asset field in an entry import
  2. Run the import

If you remove the default file setting the import works.

Additional info

  • Craft version: 4.2.8
  • PHP version: 8.1.11
  • Database driver & version: MySQL 8.0.26
  • Plugins & versions: FeedMe 5.0.4
@siffring siffring added the bug label Oct 19, 2022
@DTesch-Reem
Copy link

Also experiencing this bug.

@i-just
Copy link
Contributor

i-just commented Jan 20, 2023

Hi, thanks for reporting. I need help replicating this issue. I tried a JSON feed for entry import with add & update strategy; my asset field has access to all volumes and is a standalone field (not embedded in a matrix or anything like that). Could anyone please give me some more info on how I can reproduce this?

@siffring
Copy link
Author

@i-just I don't have that environment setup any more, but as I recall I was just trying to assign a default image to an asset field. I don't recall if the asset was in an Matrix or stand alone.

My source was a Google Sheet if that matters.

@i-just
Copy link
Contributor

i-just commented Jan 24, 2023

Thanks for the info. The source shouldn’t matter here.

I can replicate this if I map the assets field to a value from a feed, have some empty values in my feed and then still select a default value.

Screenshot 2023-01-24 at 11 38 02

We’ll discuss this behaviour internally.

@angrybrad
Copy link
Member

Resolved in #1229

@brandonkelly
Copy link
Member

Feed Me 4.6.0 (Craft 3) and 5.1.0 (Craft 4) have been released with the fix for this.

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

No branches or pull requests

5 participants