When importing an image style via the configuration import utility, the following fatal error is generated.

Steps to reproduce:

1. Visit: /admin/config/development/configuration/single/import
2. Import the image style config, sample:

uuid: 9184d3a9-a8c0-42f1-95ae-da02b09ac4b0
langcode: en
status: true
dependencies: {  }
_core:
  default_config_hash: cCiWdBHgLwj5omG35lsKc4LkW4MBdmcctkVop4ol5x0
name: thumbnail
label: 'Thumbnail (100x100 test)'
effects:
  f888edd2-ad2b-4995-b3cc-0cd01cb54b14:
    uuid: f888edd2-ad2b-4995-b3cc-0cd01cb54b14
    id: image_scale
    weight: 0
    data:
      width: 100
      height: 100
      upscale: true

Expected result:

The updated image style configuration should be imported, however a fatal error is returned instead.

Actual result:

Error: Call to a member function read() on array in field_config_import_steps_alter() (line 294 of core/modules/field/field.module).

Comments

davidwhthomas created an issue. See original summary.

davidwhthomas’s picture

Issue summary: View changes
tr’s picture

I was able to import your configuration without an error.

davidwhthomas’s picture

@TR thanks for checking it, interesting to hear it's working for you.

Here's the full stack trace for the error from this end:

The website encountered an unexpected error. Please try again later.
Error: Call to a member function read() on array in field_config_import_steps_alter() (line 294 of core/modules/field/field.module).
field_config_import_steps_alter(Array, Object, NULL) (Line: 539)
Drupal\Core\Extension\ModuleHandler->alter('config_import_steps', Array, Object) (Line: 537)
Drupal\Core\Config\ConfigImporter->initialize() (Line: 402)
Drupal\config\Form\ConfigSingleImportForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder->processForm('config_single_import_form', Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder->buildForm('config_single_import_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 666)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Not sure if core v8.5 vs 8.6 difference? as testing in v8.5.6
Can't see anything particular in relation to custom code in the stack trace but will continue investigating.

tr’s picture

I am using 8.6.x right now, but I would be surprised if there were any differences in image styles between 8.6 and 8.5 ...

davidwhthomas’s picture

I replicated the error on the clean install at https://www.opensourcecms.com/drupal/

The image style needs to be updated to return the error on config import

First import:

uuid: 9184d3a9-a8c0-42f1-95ae-da02b09ac4b0
langcode: en
status: true
dependencies: {  }
_core:
  default_config_hash: cCiWdBHgLwj5omG35lsKc4LkW4MBdmcctkVop4ol5x0
name: thumbnail_test
label: 'Thumbnail (100x100 test)'
effects:
  f888edd2-ad2b-4995-b3cc-0cd01cb54b14:
    uuid: f888edd2-ad2b-4995-b3cc-0cd01cb54b14
    id: image_scale
    weight: 0
    data:
      width: 100
      height: 100
      upscale: true

Second update import

uuid: 9184d3a9-a8c0-42f1-95ae-da02b09ac4b0
langcode: en
status: true
dependencies: {  }
_core:
  default_config_hash: cCiWdBHgLwj5omG35lsKc4LkW4MBdmcctkVop4ol5x0
name: thumbnail_test
label: 'Thumbnail (100x100 test 2)'
effects:
  f888edd2-ad2b-4995-b3cc-0cd01cb54b14:
    uuid: f888edd2-ad2b-4995-b3cc-0cd01cb54b14
    id: image_scale
    weight: 0
    data:
      width: 100
      height: 100
      upscale: true

Result:

The website encountered an unexpected error. Please try again later. ( Same error detail can be seen in https://s1.demo.opensourcecms.com/drupal/admin/reports/dblog )

Error: Call to a member function read() on array in field_config_import_steps_alter() (line 294 of /var/www/html-php7.1/drupal/core/modules/field/field.module) #0 /var/www/html-php7.1/drupal/core/lib/Drupal/Core/Extension/ModuleHandler.php(539)

tr’s picture

Yes, if I try to import the config a second time I get the same error as you do. That seems to be the key step - importing once works, but modifying and importing a second time (with the same uuid of course) generates the above error.

I also tried this importing it twice without the _core key (which I believe is internal and doesn't appear in the export so shouldn't be in the import...), but this also failed.

I also tried importing, then exporting, editing, and importing again. Again, this also failed.

So I think you've found a bug. I can't say I've ever seen that on any other config type, and the traceback doesn't seem too helpful.

davidwhthomas’s picture

Thanks for checking, after some debug, just noting the array that is returned from field.module line 294$config_importer->getStorageComparer()->getSourceStorage() has the element

array ('config_importer' => ... )

as the top level key there, from the Call to a member function read() on array

Will keep investigating.

davidwhthomas’s picture

Component: image system » configuration system
eacute’s picture

Same problem here, but it s affecting my 8.6.1 while importing image_styles or entity_view_display.

Config to import :

uuid: c9ebf68c-5b9e-45f4-87d6-27f22087cc98
langcode: fr
status: true
dependencies: {  }
name: vignette_produit
label: 'Vignette produit'
effects:
  89b46d56-035e-467b-9d81-80d229c8928d:
    uuid: 89b46d56-035e-467b-9d81-80d229c8928d
    id: image_scale_and_crop
    weight: 1
    data:
      width: 100
      height: 100

Existing config :

uuid: c9ebf68c-5b9e-45f4-87d6-27f22087cc98
langcode: fr
status: true
dependencies: {  }
name: vignette_produit
label: 'Vignette produit'
effects:
  89b46d56-035e-467b-9d81-80d229c8928d:
    uuid: 89b46d56-035e-467b-9d81-80d229c8928d
    id: image_scale_and_crop
    weight: 1
    data:
      width: 100
      height: 100
      anchor: center-center	

It looks there is some difference in core with 8.5 vs 8.6 not in the config importation but with image styles Add crop anchor option to Scale and Crop image effect

eugis’s picture

I've got the same error importing "Node delete action"

uuid: 074ebc80-8706-4ed7-ac7b-4c78252db614
langcode: lt
status: true
dependencies:
  module:
    - node
_core:
  default_config_hash: Zx0jD1Klh5tZaGJy8uOeR_2MCu9FDM4xg7TaUJUEbkI
id: node_delete_action
label: 'Delete node'
type: node
plugin: node_delete_action
configuration: {  }
pasqualle’s picture

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

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Status: Active » Closed (duplicate)
Issue tags: +Bug Smash Initiative
Related issues: +#2976773: Single config import of image styles is broken

Thanks for reporting this issue. We rely on issue reports like this one to resolve bugs and improve Drupal core.

As part of the Bug Smash Initiative, we are triaging Drupal core issues with the priority 'Major'.

As suggested in #12 this seems like a duplicate of #2976773: Single config import of image styles is broken. I've just closed that as I cannot reproduce it on 9.0.x and reading through this ticket I can't see any different steps to reproduce. I have tried based on #6 importing the first config, then the second, then the first again but this all works as expected.

I can't find where this was fixed but it certainly seems to be!