Pennebaker / craft-architect

A plugin for importing and exporting content models from Craft 3/4 using JSON.
MIT License
72 stars 6 forks source link

Invalid argument supplied for foreach() When importing Routes #39

Closed rgbjay closed 4 years ago

rgbjay commented 5 years ago

When I am importing four custom routes, it is failing and throwing the above exception. JSON is valid and being generated from Architect on another Craft 3 install.

Generated JSON below (I have tried it with both escaped and non-escaped characters FYI):

{
  "routes": [
    {
      "template": "_sitemap.html",
      "uriParts": [
        "\/sitemap"
      ]
    },
    {
      "template": "events\/_event-filter",
      "uriParts": [
        "\/fetch-events"
      ]
    },
    {
      "template": "search-results.html",
      "uriParts": [
        "\/search-results"
      ]
    },
    {
      "template": "blog\/_post-filter",
      "uriParts": [
        "\/fetch-posts"
      ]
    }
  ]
}

Craft v3.1.25 PHP 7.2.9 MySQL 5.7.23

Any help would be appreciated!

spAnser commented 5 years ago

I was able to import this in my test environment.

Also I think the exception didn't get attached.

rgbjay commented 5 years ago

Hmm, insteresting.

Sorry the exception that I refer to is the one in the title Invalid argument supplied for foreach()

spAnser commented 4 years ago

Finally got around to looking at issues again and I found the fix for this. It happened when you had no routes at all on the site. Should be fixed in the next release coming today.