editor_post_update_sanitize_image_upload_settings fails on missing text format

Created on 24 July 2024, about 2 months ago
Updated 30 July 2024, about 1 month ago

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.

🐛 Bug report
Status

Needs work

Version

10.4

Component
CKEditor 5 

Last updated 2 days ago

Created by

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @sboden
  • 🇺🇸United States cilefen

    ^ Ignore that comment. I misread the trace.

  • 🇺🇸United States cilefen

    getFilterFormat() returns null. Why?

  • 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.

  • 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.

  • 🇬🇧United Kingdom catch

    This sounds similar-ish to 🐛 Avoid TypeError if config entity dependencies are NULL Fixed .

    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.

  • #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.

  • Status changed to Needs review about 1 month ago
  • 🇬🇧United Kingdom catch

    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.

  • Merge request !8976Editor upgrade path shouldn't fatal → (Open) created by catch
  • Status changed to Needs work about 1 month ago
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    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.

Production build 0.71.5 2024