Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PunamShelke created an issue. See original summary.

mikeryan’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: -warning: Invalid argument supplied for foreach()

Could you provide the .yml for the migration that's giving you this warning? Thanks.

PunamShelke’s picture

I have attached .yml file,

mikeryan’s picture

Status: Postponed (maintainer needs more info) » Active

Please be sure to reset the status when replying to a "Postponed (maintainer needs more info)" issue.

mikeryan’s picture

Status: Active » Needs work
Issue tags: +Needs tests

I feel like there must be something funky in how the process pipeline is laid out in YAML to trigger this, but I can't see it (I do see "author : administrator" with an unwanted space before the colon, but don't see how that would cause this error).

At any rate, not a bad idea to bulletproof the code here. We do need a test demonstrating the problem though (so, still need to diagnose why it's happening to you).

+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -349,16 +349,18 @@ public function getProcessPlugins(array $process = NULL) {
+        if(is_array($configurations)){

Space after "if".

PunamShelke’s picture

Hi,

I found that issues

  1. some fields are mapped directly i.e field_name: value
  2. some fields are mapped through plugin
  3. for direct field mapping i change to like this

    field_name:
    -
    plugin: get
    source: ContentOwner

After Changing the field mapping that warning get fixed but the getting new warning
"Invalid argument supplied for foreach() Get.php:112"
record get migrated properly but getting this warning.

For this warning i did change mapping like this
field_name:
-
plugin: skip_on_empty
method: process
source: ContentOwner
-
plugin: get
source: ContentOwner

but still i m getting the same warning....

any idea how to fix it.....

quietone’s picture

The spacing looks wrong to me in this section of the yml.

  # Unique ID.
  ids:
     ContentID:
      type: integer
PunamShelke’s picture

Thanks

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Version: 8.6.x-dev » 8.8.x-dev
Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
1.56 KB
3.45 KB

Adding a test.

quietone’s picture

Another option is to thrown an exception when the process pipeline has an error.

The last submitted patch, 13: 2886349-13-fail.patch, failed testing. View results

heddn’s picture

Status: Needs review » Needs work
+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -363,16 +363,23 @@ public function getProcessPlugins(array $process = NULL) {
+        if (is_array($configurations)) {

Rather then nesting further, can we do a !is_array and throw the exception? It is a nit, but will make the code more readable.

quietone’s picture

Status: Needs work » Needs review
FileSize
2.07 KB
2.26 KB

Yes, that would be better.

heddn’s picture

Status: Needs review » Needs work
+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -363,6 +363,11 @@ public function getProcessPlugins(array $process = NULL) {
+        if (!is_array($configurations)) {
+          if (!$this->processPlugins[$index][$property]) {

Let's combine these as a single if statement.

quietone’s picture

Status: Needs work » Needs review
FileSize
1.05 KB
2.04 KB

Sure thing.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Let's assume this is green. On to rtbc.

  • catch committed b147d5e on 8.8.x
    Issue #2886349 by quietone, PunamShelke, mikeryan, heddn: Invalid...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed b147d5e and pushed to 8.8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.