Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fatal errors when updating from version 1.22.2 to 1.31.1 #6963

@jenlampton

Description

@jenlampton

Description of the bug

I'm seeing the following error when running update.php:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: https://backdrop.ddev.site/core/update.php?op=selection&token=5rNtFIz6xZokmlD&action=update&id=18&op=do_nojs&op=do StatusText: error ResponseText: TypeError: array_merge(): Argument #1 must be of type array, null given in array_merge() (line 1264 of backdrop/core/modules/file/file.install).

Line 1264 is the last one shown below:

  $config = config('file.type.document');
  $mimetypes = $config->get('mimetypes');
  $mimetypes = array_merge($mimetypes, array(

Here we are assuming that $config->get( returns an array, but if mimetypes has not been set this value is actually FALSE.

We either need this update to have a dependency on the update where these were set, or we neeed to set this to an empty array.

Setting it to an empty array results in the following errors, but it does complete the update:

Warning: Undefined array key "module" in _file_types_build() (line 2452 of backdrop/core/modules/file/file.module).
Warning: Undefined array key "name" in _file_types_build() (line 2463 of backdrop/core/modules/file/file.module).
Warning: Undefined property: stdClass::$type in file_entity_info() (line 469 of backdrop/core/modules/file/file.module).
Warning: Undefined property: stdClass::$name in file_entity_info() (line 470 of backdrop/core/modules/file/file.module).
Warning: Undefined property: stdClass::$type in file_entity_info() (line 473 of backdrop/core/modules/file/file.module).
Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in file_entity_info() (line 473 of backdrop/core/modules/file/file.module).

Steps To Reproduce

To reproduce the behavior:

  1. Install Backdrop 1.22.2
  2. Add a bunch of files with type image/jpeg or image/png into the field_image on Posts.
  3. ??? (checking on any other necessary configs...)
  4. Update to 1.31.1
  5. Run core/update.php

Actual behavior

Fatal error, see above.

Expected behavior

Successful update.

Additional information

Add any other information that could help, such as:

  • Backdrop CMS version: 1.22.2 to 1.31.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions