Problem/Motivation

It is no longer possible to add fields to a content type via the UI. Trying to do so results in

Error: Unsupported operand types in FieldInfo->prepareField() (line 495 of /var/www/html/modules/field/field.info.class.inc).
The website encountered an unexpected error. Please try again later. 

That issue added a field instance for a comment_body on the comment_node_et content type. The field_id is '54' but there is no such field.

Steps to reproduce

  1. Drop db from d7 site
  2. apply patch
  3. php core/scripts/db-tools.php import --database=d7_dump core/modules/migrate_drupal/tests/fixtures/drupal7.php
  4. go to d7 site
  5. clear cache
  6. go admin/structure/types/manage/article/fields
  7. add a field, any type will do
  8. Click 'save'

Proposed resolution

Change the field_id from '54' to '1' for the field_config_instance of 'comment_body' on the 'comment_node_et' content type.

Update FieldDiscoveryTest now that the field will actually be discovered.

Remaining tasks

Patch, Review, Commit

CommentFileSizeAuthor
#2 3163162-2.patch1.35 KBquietone

Comments

quietone created an issue. See original summary.

quietone’s picture

Status: Active » Needs review
StatusFileSize
new1.35 KB

And a fix.

quietone’s picture

Issue summary: View changes
Issue tags: +Bug Smash Initiative

I retested this to be sure.

  1. Drop db from d7 site
  2. apply patch
  3. php core/scripts/db-tools.php import --database=d7_dump core/modules/migrate_drupal/tests/fixtures/drupal7.php
  4. go to d7 site
  5. clear cache
  6. go admin/structure/types/manage/article/fields
  7. add a field, any type will do
  8. Click 'save'
  9. No error!

Note to self: Always test changes to the fixture via the UI.

quietone’s picture

Title: Fix error in d7 fixture » Fix error in d7 fixture field_config_instance table
Issue summary: View changes
jungle’s picture

--- a/core/modules/migrate_drupal/tests/fixtures/drupal7.php
+++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php

@@ -5284,7 +5284,7 @@
-  'field_id' => '54',
+  'field_id' => '1',

@@ -282,7 +282,7 @@ public function testGetAllFields() {
-    $this->assertCount(6, $actual_fields['comment']);
+    $this->assertCount(7, $actual_fields['comment']);

The changes are made to the test fixture, as the testing passed, it looks good to go, however, would be great to have a manual test following the "Steps to reproduce" in the IS. To me it's optional as @quietone already did in #3 again, so setting to RTBC directly.

Thanks!

jungle’s picture

Status: Needs review » Reviewed & tested by the community

Forgot changing the status

alexpott’s picture

Version: 9.1.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Fixed

Applied the patch to 8.9.x and it passed there so this is relevant for D8 too.

Committed and pushed ef06a015ec to 9.1.x and 70c84d095f to 9.0.x and 010940e479 to 8.9.x. Thanks!

  • alexpott committed ef06a01 on 9.1.x
    Issue #3163162 by quietone: Fix error in d7 fixture...

  • alexpott committed 70c84d0 on 9.0.x
    Issue #3163162 by quietone: Fix error in d7 fixture...

  • alexpott committed 010940e on 8.9.x
    Issue #3163162 by quietone: Fix error in d7 fixture...

Status: Fixed » Closed (fixed)

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