When updating from Drupal 10.2.7 to Drupal 10.3.1, I get following after drush updb:

>[notice] Update started: editor_post_update_sanitize_image_upload_settings
>  [error]  Error: Call to a member function getConfigDependencyName() on null in Drupal\editor\Entity\Editor->calculateDependencies() (line 128 of /data/code/energyapp/www/core/modules/ed
itor/src/Entity/Editor.php) #0 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(324): Drupal\editor\Entity\Editor->calculateDependencies()
> #1 /data/code/energyapp/www/core/lib/Drupal/Core/Entity/EntityStorageBase.php(528): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStora
ge))
> #2 /data/code/energyapp/www/core/lib/Drupal/Core/Entity/EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\editor\Entity\Editor))
> #3 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\editor\Entity\Editor))
> #4 /data/code/energyapp/www/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\editor\Entity\Editor))
> #5 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(613): Drupal\Core\Entity\EntityBase->save()
> #6 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(192): Drupal\Core\Config\Entity\ConfigEntityBase->save()
> #7 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(147): Drupal\Core\Config\Entity\ConfigEntityUpdater->doOne(Object(Drupal\editor\Entity\Editor), Obj
ect(Closure))
> #8 /data/code/energyapp/www/core/modules/editor/editor.post_update.php(68): Drupal\Core\Config\Entity\ConfigEntityUpdater->update(Array, 'editor', Object(Closure))
> #9 /data/code/energyapp/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(280): editor_post_update_sanitize_image_upload_settings(Array)
> #10 /data/code/energyapp/vendor/drush/drush/includes/batch.inc(257): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('editor_post_upd...', Array)
> #11 /data/code/energyapp/vendor/drush/drush/includes/batch.inc(204): _drush_batch_worker()
> #12 /data/code/energyapp/vendor/drush/drush/includes/batch.inc(75): _drush_batch_command('154')
> #13 /data/code/energyapp/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(136): drush_batch_command('154')
> #14 [internal function]: Drush\Commands\core\UpdateDBCommands->process('154', Array)
> #15 /data/code/energyapp/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
> #16 /data/code/energyapp/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolida
tion\AnnotatedCommand\CommandData))
> #17 /data/code/energyapp/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(C
onsolidation\AnnotatedCommand\CommandData))
> #18 /data/code/energyapp/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\O
utput\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #19 /data/code/energyapp/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Obje
ct(Symfony\Component\Console\Output\ConsoleOutput))
> #20 /data/code/energyapp/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Co
mponent\Console\Output\ConsoleOutput))
> #21 /data/code/energyapp/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(
Symfony\Compone
> #22 /data/code/energyapp/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Compo
nent\Console\Output\ConsoleOutput))
> #23 /data/code/energyapp/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Com
ponent\Console\Output\ConsoleOutput))
> #24 /data/code/energyapp/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #25 /data/code/energyapp/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
> #26 /data/code/energyapp/vendor/drush/drush/drush(4): require('/data/code/ener...')
> #27 /data/code/energyapp/vendor/bin/drush(120): include('/data/code/ener...')
> #28 {main}. 
> Error: Call to a member function getConfigDependencyName() on null in /data/code/energyapp/www/core/modules/editor/src/Entity/Editor.php on line 128 #0 /data/code/energyapp/www/core/li
b/Drupal/Core/Config/Entity/ConfigEntityBase.php(324): Drupal\editor\Entity\Editor->calculateDependencies()
> #1 /data/code/energyapp/www/core/lib/Drupal/Core/Entity/EntityStorageBase.php(528): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStora
ge))
> #2 /data/code/energyapp/www/core/lib/Drupal/Core/Entity/EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\editor\Entity\Editor))
> #3 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\editor\Entity\Editor))
> #4 /data/code/energyapp/www/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\editor\Entity\Editor))
> #5 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(613): Drupal\Core\Entity\EntityBase->save()
> #6 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(192): Drupal\Core\Config\Entity\ConfigEntityBase->save()
> #7 /data/code/energyapp/www/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(147): Drupal\Core\Config\Entity\ConfigEntityUpdater->doOne(Object(Drupal\editor\Entity\Editor), Obj
ect(Closure))
> #8 /data/code/energyapp/www/core/modules/editor/editor.post_update.php(68): Drupal\Core\Config\Entity\ConfigEntityUpdater->update(Array, 'editor', Object(Closure))
> #9 /data/code/energyapp/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(280): editor_post_update_sanitize_image_upload_settings(Array)
> #10 /data/code/energyapp/vendor/drush/drush/includes/batch.inc(257): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('editor_post_upd...', Array)
> #11 /data/code/energyapp/vendor/drush/drush/includes/batch.inc(204): _drush_batch_worker()
> #12 /data/code/energyapp/vendor/drush/drush/includes/batch.inc(75): _drush_batch_command('154')
> #13 /data/code/energyapp/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(136): drush_batch_command('154')
> #14 [internal function]: Drush\Commands\core\UpdateDBCommands->process('154', Array)
> #15 /data/code/energyapp/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
> #16 /data/code/energyapp/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolida
tion\AnnotatedCommand\CommandData))
> #17 /data/code/energyapp/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(C
onsolidation\AnnotatedCommand\CommandData))
> #18 /data/code/energyapp/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\O
utput\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #19 /data/code/energyapp/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Obje
ct(Symfony\Component\Console\Output\ConsoleOutput))
> #20 /data/code/energyapp/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Co
mponent\Console\Output\ConsoleOutput))
> #21 /data/code/energyapp/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(
Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #22 /data/code/energyapp/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Compo
nent\Console\Output\ConsoleOutput))
> #23 /data/code/energyapp/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Com
ponent\Console\Output\ConsoleOutput))
> #24 /data/code/energyapp/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #25 /data/code/energyapp/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
> #26 /data/code/energyapp/vendor/drush/drush/drush(4): require('/data/code/ener...')
> #27 /data/code/energyapp/vendor/bin/drush(120): include('/data/code/ener...')
> #28 {main}
>  [warning] Drush command terminated abnormally.

In ProcessBase.php line 171:
                                                                                                                                                                                             
  Unable to decode output into JSON: Syntax error                                                                                                                                            
                                                                                                                                                                                             
  Error: Call to a member function getConfigDependencyName() on null in Drupal\editor\Entity\Editor->calculateDependencies() (line 128 of /data/code/energyapp/www/core/modules/editor/src/Entity/Editor.php).                                                                                                                                                                      

And it keeps failing on that. I have had this consistently on 3 different Drupal instances.

Quick and dirty workaround I used is:
- Edit file www/core/modules/editor/editor.post_update.php
- Remove the contents of function editor_post_update_sanitize_image_upload_settings()
- Run drush updb again.

Other people seem to uninstall ckeditor5 module to get around the problem.

It's "major" in the sense that everyone who upgrades to 10.3.x will probably get the error/problem.

Issue fork drupal-3463524

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

sboden created an issue. See original summary.

cilefen’s picture

That function call is on line 126 not 128. Are patches applied?

cilefen’s picture

^ Ignore that comment. I misread the trace.

cilefen’s picture

getFilterFormat() returns null. Why?

sboden’s picture

The sites which I upgraded are very simple sites: drupal/core-recommended (initially even installed at 10.2.7, not that long ago) with the least amount of contrib modules. On some back-end forms we use ckeditor but without special config, it's possible to upload images but none of the sites have uploaded images for the moment.

sboden’s picture

I tried installing a clean Drupal 10.2.7 (drupal/core-recommended) and upgrading to 10.3.1: works fine, editor_post_update_sanitize_image_upload_settings executes without problems.

But for the moment I don't see what config on my real sites could crash editor_post_update_sanitize_image_upload_settings.

catch’s picture

This sounds similar-ish to #3460513: Avoid TypeError if config entity dependencies are NULL.

Can you double check your editor config entities, specifically:

format: the_format_name

And that these formats correspond to a text format i.e. filter.format.* in config/sync

All I can think of is an editor is referring to a text format that no longer exists. If that's the error, we probably need to handle this and log an error instead of the fatal or similar.

sboden’s picture

#7 is right. I played with drupal/webform in the beginning of the projects and removed it afterwards. But in the config I still had:

editor.editor.webform_default.yml: - filter.format.webform_default
editor.editor.webform_default.yml:format: webform_default

And "webform_default" does not exist anymore as a filter.

If this could be handled without fatal error it would be great.

catch’s picture

Priority: Major » Critical
Status: Active » Needs review
Issue tags: +10.3.0 upgrade path

Bumping this to critical - enabling then uninstalling webform can't be that uncommon.

Here's an MR that should mean there's no fatal error on the upgrade path, but it's also possible that editor module isn't handling module uninstall correctly too.

catch’s picture

Version: 10.3.x-dev » 10.4.x-dev
catch’s picture

Title: editor_post_update_sanitize_image_upload_settings fails » editor_post_update_sanitize_image_upload_settings fails on missing text format
alexpott’s picture

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

We need an issue to fix webform. Webform's using of filter formats has been causing a lot of problems.

I think the hardening is okay here and I like the use of trigger_error(). I think a test would be a nice thing to have.

liam morland’s picture

How would a test for this work? Would it have to create a fake missing text format?

The message uses $this->id() twice. That doesn't seem right to me.

The editor {$this->id()} is configured for text format {$this->id()} which does not exist.

Should one of them instead be $this->label()?

quietone’s picture

Version: 10.4.x-dev » 10.6.x-dev
quietone’s picture

Status: Needs work » Needs review

Had a go at a test.

quietone’s picture

Issue tags: -10.3.0 upgrade path +10.3.0 update
smustgrave’s picture

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

Removing the test tag since test-only run show https://git.drupalcode.org/issue/drupal-3463524/-/jobs/8344357

Not sure if still valid with 10.3 been out for a while but going to mark.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 7f0e816 and pushed to 10.6.x. Thanks!
Committed and pushed 5e89bf91349 to main and 4fff169a7b3 to 11.x and 15e3a121b9b to 11.3.x. Thanks!

I forward ported the code change to 11.x, 11.3.x and main and I will open a follow-up to add test coverage there as the current test will not work on those branches because PHPUnit has removed the capability to expect a warning.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 7f0e8169 on 10.6.x
    fix: #3463524 editor_post_update_sanitize_image_upload_settings fails on...

  • alexpott committed 15e3a121 on 11.3.x
    fix: #3463524 editor_post_update_sanitize_image_upload_settings fails on...

  • alexpott committed 4fff169a on 11.x
    fix: #3463524 editor_post_update_sanitize_image_upload_settings fails on...

  • alexpott committed 5e89bf91 on main
    fix: #3463524 editor_post_update_sanitize_image_upload_settings fails on...
alexpott’s picture

Status: Fixed » Closed (fixed)

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