craftcms/feed-me

Feedme 5.6.0 update causing array_splice error with Assets

Closed this issue ยท 7 comments

Description

After updating to feedme 5.6.0 from 5.5.0, imports which use Assets are failing with an error:

array_splice(): Argument #1 ($array) must be of type array, null given - Assets.php: 122.

Rolling back to 5.5.0 resolves the issue and we are able to import again.

Steps to reproduce

  1. Import with a json feed and configure feedme to import the images as assets

[
    {
         "defaultImage" : "https:\/\/example.com\/images\/default.jpeg",
         "images": [
            {
                "image": "https:\/\/example.com\/images\/image.jpeg?r=9",
            }   ,
            {
                "image": "https:\/\/example.com\/images\/image-2.jpeg?r=9",
            }   
          ]
    },
    {
         "defaultImage" : "https:\/\/example.com\/images\/default2.jpeg",
         "images": [
            {
                "image": "https:\/\/example.com\/images\/image-3.jpeg?r=9",
            }   ,
            {
                "image": "https:\/\/example.com\/images\/image-4.jpeg?r=9",
            }   
          ]
    }
]
  1. Run import

  2. Check logs, nothing imported in due to error

array_splice(): Argument #1 ($array) must be of type array, null given - Assets.php: 122.
  1. Rollback to 5.5.0 and run above. No errors reported.

Additional info

  • Craft version: 4.10.5
  • PHP version: 8.1.29
  • Database driver & version: MariaDB 10.4.34
  • Plugins & versions:
Breadcrumb 	2.0.0
Cookie Consent Banner 	2.0.1
Embedded Assets 	4.1.0
Feed Me 	5.6.0
Google Maps 	4.5.2
Imager X 	4.4.1
Pitch 	2.4.0
Redactor 	3.1.0
SEOmatic 	4.1.0
Sprig 	2.8.1
Super Table 	3.0.14
Wishlist 	2.0.11

I'm experiencing this too in version 6.2.0 on Craft 5. As above, rolling back to the previous release, in this case 6.1.0, resolved the issue.

I found out that you need to have a value in the 'Use this filename for assets created from URL' field (FeedMe 6.2.0).

A workaround for this issue, if you have no image names as a separate field, is by mapping the image URL in the 'Use this filename for assets created from URL' field; you will get odd names though.

@lucasdaniels You can set:

Use this filename for assets created from URL:
Use default value

and it will keep just the filenames

Hi all, thanks for reporting! I raised a PR for this.

Merged and will be included in the next v5 and v6 release!

Feed Me 5.6.1 and 6.2.1 are out with this fix.

@angrybrad @i-just - thank you for the fix!