backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 39 forks source link

Importing vocabulary with field shows PHP warnings #6715

Open yorkshire-pudding opened 4 days ago

yorkshire-pudding commented 4 days ago

Description of the bug

Found on PHP 8.3 but could arise in earlier versions. I found this while testing the fix for #2237 If importing a taxonomy vocabulary with field(s), it imports but warnings are shown

Steps To Reproduce

To reproduce the behavior:

  1. Create a taxonomy vocab with a field
  2. Export config
  3. Delete the vocab in the UI
  4. Run import

Actual behavior

Vocab was successfully imported but warnings:

user@machine:~/projects/bee/backdrop$ lando bee config-import
The following config will be imported:

| Config                                       | Status |
| field.bundle.taxonomy_term.test              | create |
| field.field.field_test                       | create |
| field.instance.taxonomy_term.test.field_test | create |
| taxonomy.vocabulary.test                     | create |

Would you like to continue? (y/N): y

 ⚠️  Warning: Attempt to read property "weight" on false
in {closure}() (line 1247 of /app/backdrop/core/modules/taxonomy/taxonomy.module).

 ⚠️  Warning: Attempt to read property "name" on false
in taxonomy_entity_info() (line 126 of /app/backdrop/core/modules/taxonomy/taxonomy.module).

 ⚠️  Warning: Attempt to read property "weight" on false
in {closure}() (line 1247 of /app/backdrop/core/modules/taxonomy/taxonomy.module).

 ⚠️  Warning: Attempt to read property "name" on false
in taxonomy_entity_info() (line 126 of /app/backdrop/core/modules/taxonomy/taxonomy.module).

 ✔  Config was imported to './files/config_1e61159187070230b1449cb58f5770dd/active'.
 ℹ  4 files were synced.

Expected behavior

user@machine:~/projects/bee/backdrop$ lando bee config-import
The following config will be imported:

| Config                                       | Status |
| field.bundle.taxonomy_term.test              | create |
| field.field.field_test                       | create |
| field.instance.taxonomy_term.test.field_test | create |
| taxonomy.vocabulary.test                     | create |

Would you like to continue? (y/N): y

 ✔  Config was imported to './files/config_1e61159187070230b1449cb58f5770dd/active'.
 ℹ  4 files were synced.

Additional information

Add any other information that could help, such as:

yorkshire-pudding commented 3 days ago

I think part of the issue is this file, which doesn't seem to be populated with name. I wonder if this file is redundant as I don't see comparable files for node types.

field.bundle.taxonomy_term.[vocab_name] ```json { "_config_name": "field.bundle.taxonomy_term.test", "bundle": "test", "entity_type": "taxonomy_term", "view_modes": [], "extra_fields": { "form": { "name": { "weight": "-5" }, "description": { "weight": "0" } }, "display": [] } } ```