Problem/Motivation

Invalid argument supplied for foreach() UpdateChecklist.php:181
and
count(): Parameter must be an array or an object that implements Countable UpdateChecklist.php:210
are a couple errors when building out a Varbase distro.

Simple little things but I'm sorry I'm not able to give a patch for them now.

Proposed resolution

Proposed fix for the issue by Alex Pott (alexpott)

This is not the expected format for $checklist->markUpdatesSuccessful($update_ids, TRUE);. It should be:

  $update_ids = [
      'varbase_core' => [
        'varbase_core_optional_update_8601',
        'varbase_core_optional_update_8602',
        'varbase_core_optional_update_8603',
        'varbase_core_optional_update_8604',
        'varbase_core_optional_update_8605',
        'varbase_core_optional_update_8606',
        'varbase_core_optional_update_8607',
        'varbase_core_update_8608',
        'varbase_core_update_8610',
        'varbase_core_optional_update_8701',
        'varbase_core_optional_update_8702',
        'varbase_core_update_8703',
        'varbase_core_update_8704',
        'varbase_core_optional_update_8705',
        'varbase_core_optional_update_8706',
      ],
      'varbase_admin' => [
        'varbase_admin_update_8602',
      ]
    ];

Note that the other code in this method will need adjusted too.

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Fix array to mark all updates by the update helper checklist as successful on install.
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ Update Release Notes and Update Helper on new feature change/addition
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Release varbase-9.0.3, varbase_core-9.0.12

Varbase update type:

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Comments

ahillio created an issue. See original summary.

alexpott’s picture

Project: Update helper » Varbase Core
Version: 2.0.0 » 9.0.x-dev

I've looked over where this code is called and this is not caused by anything in the Update Helper module. It's caused by varbase_update_helper_install().

This function is passing in the following array.

    $update_ids = [
      'varbase_core:varbase_core_optional_update_8601',
      'varbase_core:varbase_core_optional_update_8602',
      'varbase_core:varbase_core_optional_update_8603',
      'varbase_core:varbase_admin_update_8602',
      'varbase_core:varbase_core_optional_update_8604',
      'varbase_core:varbase_core_optional_update_8605',
      'varbase_core:varbase_core_optional_update_8606',
      'varbase_core:varbase_core_optional_update_8607',
      'varbase_core:varbase_core_update_8608',
      'varbase_core:varbase_core_update_8610',
      'varbase_core:varbase_core_optional_update_8701',
      'varbase_core:varbase_core_optional_update_8702',
      'varbase_core:varbase_core_update_8703',
      'varbase_core:varbase_core_update_8704',
      'varbase_core:varbase_core_optional_update_8705',
      'varbase_core:varbase_core_optional_update_8706',
    ];

This is not the expected format for $checklist->markUpdatesSuccessful($update_ids, TRUE);. It should be:

    $update_ids = [
      'varbase_core' => [
        'varbase_core_optional_update_8601',
        'varbase_core_optional_update_8602',
        'varbase_core_optional_update_8603',
        'varbase_core_optional_update_8604',
        'varbase_core_optional_update_8605',
        'varbase_core_optional_update_8606',
        'varbase_core_optional_update_8607',
        'varbase_core_update_8608',
        'varbase_core_update_8610',
        'varbase_core_optional_update_8701',
        'varbase_core_optional_update_8702',
        'varbase_core_update_8703',
        'varbase_core_update_8704',
        'varbase_core_optional_update_8705',
        'varbase_core_optional_update_8706',
      ],
      'varbase_admin' => [
        'varbase_admin_update_8602',
      ]
    ];

Note that the other code in this method will need adjusted too.

FWIW I'm not sure why any of this code is needed in varbase. I think update_helper_checklist_install() should be handling this already.

Rajab Natshah’s picture

Thank you, Alex for moving the issue to Varbase Core.
It will be tested and fixed.

Rajab Natshah’s picture

Title: invalid argument in UpdateChecklist.php » Invalid argument supplied for foreach() UpdateChecklist.php
Rajab Natshah’s picture

Title: Invalid argument supplied for foreach() UpdateChecklist.php » Fix Invalid argument supplied for foreach() UpdateChecklist.php

Alex, Some sites may not have the module installed by default.
On install it should show 100%

This is to fix the status to 100% on install and on an installation for optional components or in a Sub Profiles

The Update Helper module had performance issues
When the site admin decided to disable the module then enable it again.

The site will end up with some weird status like 106%, 112% or 109%.
And some time we get 60% or 40% if the active site had changes at the time of enabling of a new module, which could do a small change in active config.

Before it was $checklist->getPercentComplete() != 100 which is wrong and we had it fixed with $checklist->getPercentComplete() < 100 in #3118031: Fix performance for anonymous users on page load for [Update Helper Checklist] module with XHProf statistics

Noticed your new commit on the issue to fix this.

Rajab Natshah’s picture

Issue summary: View changes
Rajab Natshah’s picture

Issue summary: View changes
Rajab Natshah’s picture

Issue summary: View changes
Rajab Natshah’s picture

Issue summary: View changes

  • RajabNatshah committed 9c815c5 on 9.0.x
    Issue #3218138 by RajabNatshah, ahillio, alexpott: Fix Invalid argument...
Rajab Natshah’s picture

Assigned: Unassigned » Mohammed J. Razem
Issue summary: View changes
Status: Active » Needs review
Issue tags: +varbase-9.0.3, +varbase_core-9.0.12
Rajab Natshah’s picture

Assigned: Mohammed J. Razem » Unassigned
Rajab Natshah’s picture

Status: Needs review » Fixed
Rajab Natshah’s picture

Issue summary: View changes
Rajab Natshah’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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