Problem/Motivation

Reported in slack.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3564548

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

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs work
Issue tags: +Needs manual testing

Needs testing against a database with the problem.

bertvivie’s picture

When updating from drupal version 11.2.5 to 11.3.1 after testing the update on my local machine where I had no problems the update.php broke on the production server with this error:

Er is een AJAX HTTP fout opgetreden.
HTTP-resultaatcode: 200
Debug informatie volgt.
Pad: /web/update.php/start?id=177&op=do_nojs&op=do
Statustekst: parsererror
Antwoordtekst: TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() (line 46 of /var/www/vhosts/redcaps.nl/httpdocs/web/core/modules/update/update.post_update.php).

I put my error at Slack in the support channel and within a few hours @catch made this patch for me.
I installed this patch first local and then pushed it with git on my production server and installed it there.
When running the update.php again it now runs completely to the end
Conclusion: My problem is solved and this patch is tested

catch’s picture

Status: Needs work » Needs review
Issue tags: -Needs manual testing

Additional testing in slack from @bertvivie found that even after running the update, the update status settings form wouldn't save with 'fetch' is a required field which suggests all of the update status configuration was corrupted. That was solveable in this case by uninstalling and re-installing, not clear what got the site into this case.

I think checking we actually have an array is probably OK here - it will at least result in that key being set if it's wrong, instead of a fatal error that prevents the site update. So moving to needs review.

xamount’s picture

Status: Needs review » Reviewed & tested by the community

I had the exact same issue and this was my error on dev:

// Do you wish to run the specified pending updates?: yes.                     
>  [notice] Update started: update_post_update_fix_update_emails
>  [error]  TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() 

Just like @bertvivie, the error only occurred when I pushed up it to my dev server. The error did not occur locally.

I'm using config split. So on localhost update.settings.yml exists but on dev/stage/prod update.settings.yml does not exist. That should shed some light on the problem.

So even though the update settings module is enabled on dev, the update.settings.yml may not exist and hence update_post_update_fix_update_emails fails.

The patch makes sense to me to do that check. I applied the patch and it works perfectly.

xamount’s picture

Maybe the patch can be improved to something like:

if $config = \Drupal::configFactory()->getEditable('update.settings') returns null, do nothing.

Either way the patch works as is or can be improved slightly.

alexpott’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 418d91e75dd to 11.x and ba26af15cc1 to 11.3.x. Thanks!

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 ba26af15 on 11.3.x
    fix: #3564548 update_post_update_fix_update_emails() can fail on invalid...

  • alexpott committed 418d91e7 on 11.x
    fix: #3564548 update_post_update_fix_update_emails() can fail on invalid...

Status: Fixed » Closed (fixed)

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