Steps to reproduce:
* Create a new config form that modifies an custom configuration
* Create a route for the config form
* Make sure the custom_config doesn't exist in the active configuration
* Create a *.config_translation.yml for the custom configuration
* Go to the route for the config form

A fatal error occurs:
TypeError: Argument 2 passed to Drupal\Core\Config\TypedConfigManager::createFromNameAndData() must be of the type array, boolean given, called in /core/lib/Drupal/Core/Config/TypedConfigManager.php on line 78 in Drupal\Core\Config\TypedConfigManager->createFromNameAndData() (line 391 of core/lib/Drupal/Core/Config/TypedConfigManager.php).

This happens with Drupal 8.4.2 because the system tries to read the configuration, but since the data doesn't exist it returns FALSE, hence the error.

Issue fork drupal-2925297

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mmrares created an issue. See original summary.

mmrares’s picture

Issue summary: View changes
michielkenis’s picture

I'm having the very same issue here... I'm trying to work something out!

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.

paulvandenburg’s picture

Status: Active » Needs review
StatusFileSize
new658 bytes

Came across this same issue.
And I've worked something out.

The problem lies indeed in the TypedConfigManager as it requires the StorageInterface::read to always return an array.
But the interface clearly defines it's return type as array or false.

This requirement of always returning a value for the Typed Config was spread throughout the manager. So it was easiest to convert this possible false value to an empty array. rather than let the Typed Config manager handle the possible lack of a value.

See the enclosed patch.

leksat’s picture

Status: Needs review » Reviewed & tested by the community

#7 works great. Thanks!

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

This seems like a real error condition that should show a warning- what I think we're missing is handling the error correctly somewhere (i.e. showing that the configuration is missing, rather than this fatal). Is there any way to reproduce this via the UI or can it only happen when manually manipulating config and/or custom code.

Regardless of the approach, also needs some test coverage.

shubhangi1995’s picture

I also faced the same bug with webform module , on trying to access webforms confirgurations from admin/structure/webform/config
I have translation enabled, the patch was working perfectly.
Drupal core version: 8.6.10
Webform version: 8.x-5.2

mpp’s picture

@catch, this happens when you have a module that provides a simple config schema but no default config and/or the config is ignored.

The error will occur on the edit and translation routes of such a config object.

The patch in #7 will resolve the fatal error but instead of writing an empty configuration file (we're on the edit form, we don't want to write anything there) we may need to display a message that no config exists.

mpp’s picture

Status: Needs work » Needs review
StatusFileSize
new798 bytes

Added tests only.

mpp’s picture

StatusFileSize
new1.34 KB

Added patch.

The last submitted patch, 12: 2925297_tests_only_11.patch, failed testing. View results

renguer0’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs tests

The comments in #9 and #11 still need to be resolved here, we should give some kind of indication either in the UI or a log message that there's no configuration to translate.

shubhangi1995’s picture

in the enityt_type manager is it ok to log a warning when the default config are not found or egnored?

paulvandenburg’s picture

Status: Needs work » Needs review
StatusFileSize
new556 bytes
new1.48 KB

Added logging to solve feedback from #9 and #11.

guptahemant’s picture

I recently faced this issue when one of my custom config form was config ignored and no default value was present for it, The patch from #18 solved the issue for me.

Thanks

andypost’s picture

Version: 8.6.x-dev » 8.9.x-dev
renguer0’s picture

Solve that issue in D8.8.5 and PHP 7.4.5.

Looks good to me.

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.

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

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

pavelculacov’s picture

Fixed, Worked

michel.g’s picture

Does this still occur in 9.2.x?
We might need to reroll the patch before tagging it as reviewed and tested.

gobinathm made their first commit to this issue’s fork.

spokje’s picture

Status: Needs review » Reviewed & tested by the community

Test only patch #12 still fails on D9.2.x.
Patch #18 still applies cleanly to D9.2.x and solves the issue.

mpp’s picture

Created a Merge Request and fixed the orthography of "not existing" to "non-existent".

catch’s picture

Status: Reviewed & tested by the community » Needs work

A trigger_error() seems more appropriate for this one - then depending on error reporting it'll show people in the UI too.

anmolgoyal74 made their first commit to this issue’s fork.

spokje’s picture

Status: Needs work » Needs review

As said in the MR thread, I don't see any Resolve buttons to close the last unresolved comment.

Putting this on NR nevertheless.

spokje’s picture

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

nevergone’s picture

And now?

vodde83’s picture

I still had this issue on D9.4.x, but the patch from #18 still applies neatly and resolves the error.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

thomjjames’s picture

Like vodde83 I'm also still getting the error on Drupal 9.4.8 but the patch in #18 does also seem to fix it.

martijn de wit’s picture

Using https://git.drupalcode.org/project/drupal/-/merge_requests/195.diff from #32. Works like a charm. The real error's / warnings are now popping up.

spokje’s picture

StatusFileSize
new2.35 KB

Let's see if the diff from the MR applies to all branches.

martijn de wit’s picture

Status: Needs review » Reviewed & tested by the community

Seems RTBC to me :)

spokje’s picture

Issue tags: +Bug Smash Initiative

Tagging with BugSmash

  • catch committed 3ca98df on 10.0.x
    Issue #2925297 by Spokje, mpp, paulvandenburg, anmolgoyal74, gobinathm,...
  • catch committed d0ee369 on 10.1.x
    Issue #2925297 by Spokje, mpp, paulvandenburg, anmolgoyal74, gobinathm,...
  • catch committed 8b54960 on 9.4.x
    Issue #2925297 by Spokje, mpp, paulvandenburg, anmolgoyal74, gobinathm,...
  • catch committed ba5b309 on 9.5.x
    Issue #2925297 by Spokje, mpp, paulvandenburg, anmolgoyal74, gobinathm,...
catch’s picture

Version: 10.1.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.1.x, cherry-picked back through to 9.4.x, thanks!

Status: Fixed » Closed (fixed)

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