Set default value = [] for sandbox argument of update hooks

Created on 26 June 2023, over 1 year ago
Updated 25 September 2023, about 1 year ago

Problem/Motivation

Follow-up from #3204810-48: Add new permission for accessing help pages

ConfigEntityUpdater::update() expects an array for sandbox, so we can't default this to NULL in my book.

Steps to reproduce

core$ git grep _post_update_ |grep sandbox
core/lib/Drupal/Core/Extension/module.api.php:784:function hook_post_update_NAME(&$sandbox) {
core/modules/block_content/block_content.post_update.php:72:function block_content_post_update_sort_permissions(&$sandbox = NULL) {
core/modules/ckeditor5/ckeditor5.post_update.php:24:function ckeditor5_post_update_image_toolbar_item(&$sandbox = []) {
core/modules/ckeditor5/ckeditor5.post_update.php:72:function ckeditor5_post_update_plugins_settings_export_order(&$sandbox = []) {
core/modules/ckeditor5/ckeditor5.post_update.php:96:function ckeditor5_post_update_code_block(&$sandbox = []) {
core/modules/file/file.post_update.php:23:function file_post_update_add_permissions_to_roles(?array &$sandbox = NULL): void {
core/modules/layout_builder/layout_builder.post_update.php:42:function layout_builder_post_update_timestamp_formatter(array &$sandbox = NULL): void {
core/modules/media/media.post_update.php:28:function media_post_update_oembed_loading_attribute(array &$sandbox = NULL): void {
core/modules/responsive_image/responsive_image.post_update.php:25:function responsive_image_post_update_order_multiplier_numerically(array &$sandbox = NULL): void {
core/modules/responsive_image/responsive_image.post_update.php:37:function responsive_image_post_update_image_loading_attribute(array &$sandbox = NULL): void {
core/modules/system/system.post_update.php:62:function system_post_update_timestamp_formatter(array &$sandbox = NULL): void {
core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php:55:function update_test_postupdate_post_update_test_batch(&$sandbox = NULL) {
core/modules/system/tests/themes/test_theme_depending_on_modules/test_theme_depending_on_modules.post_update.php:13:  function test_theme_depending_on_modules_post_update_module_install(&$sandbox = NULL) {
core/modules/system/tests/themes/test_theme_updates/test_theme_updates.post_update.php:11:function test_theme_updates_post_update_test(&$sandbox = NULL) {
core/modules/text/text.post_update.php:25:function text_post_update_allowed_formats(&$sandbox = NULL) {
core/modules/user/user.post_update.php:24:function user_post_update_sort_permissions(&$sandbox = NULL) {
core/modules/user/user.post_update.php:30:function user_post_update_sort_permissions_again(&$sandbox = NULL) {
core/modules/views/views.post_update.php:48:function views_post_update_boolean_custom_titles(?array &$sandbox = NULL): void {
core/modules/views/views.post_update.php:55:function views_post_update_oembed_eager_load(?array &$sandbox = NULL): void {
core/modules/views/views.post_update.php:66:function views_post_update_responsive_image_lazy_load(?array &$sandbox = NULL): void {
core/modules/views/views.post_update.php:77:function views_post_update_timestamp_formatter(array &$sandbox = NULL): void {
core/modules/views/views.post_update.php:88:function views_post_update_fix_revision_id_part(&$sandbox = NULL): void {

Proposed resolution

- update to empty array where ConfigEntityUpdater is used
- update default docs in module.api.php

Remaining tasks

patch/review/commit

User interface changes

no

API changes

no

Data model changes

no

Release notes snippet

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Base 

Last updated about 8 hours ago

Created by

🇫🇷France andypost

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024