When we used Composer to update to the latest version of Upgrade Status, then ran drush updb, we were greeted with this error:

 [error]  TypeError: Argument 1 passed to Drupal\upgrade_status\ThemeFunctionDeprecationAnalyzer::__construct() must be an instance of Drupal\Core\DependencyInjection\Container, instance of Drupal\Core\DependencyInjection\ContainerBuilder given in Drupal\upgrade_status\ThemeFunctionDeprecationAnalyzer->__construct() (line 39 of [docroot]/modules/contrib/upgrade_status/src/ThemeFunctionDeprecationAnalyzer.php) #0 [internal function]: Drupal\upgrade_status\ThemeFunctionDeprecationAnalyzer->__construct(Object(Drupal\Core\DependencyInjection\ContainerBuilder))

It seems that this error occurs because we're running PHP 7.2 in our environment (which is still a fully supported version in Drupal 8) but Upgrade Status 8.x-2.2 requires PHP 7.3+.

Composer.json should be modified to specify that "php": "^7.3.0" is required for Upgrade Status 8.x-2.2. This should also be extended to other applicable Drupal info files, as well as the project documentation. The current alternative for folks who are still on PHP 7.2 is to specify "drupal/upgrade_status": "2.0" instead of "^2.0" and remember to change it when our environment is up to PHP 7.3.

Thanks in advance!

Comments

hunterbuchanan created an issue. See original summary.

gábor hojtsy’s picture

I don't think that is PHP 7.3 related. #3126600: Upgrade status scans fail with error 500 due to HTTP request issues, make HTTP request testing more specific has a patch for it. The constructor should have type hinted on the container interface to begin with.

gábor hojtsy’s picture

That said the into file has a PHP 7.1 requirement that should be reflected in the composer.json. Do you still believe PHP 7.3 is a requirement after applying the patch from #3126600: Upgrade status scans fail with error 500 due to HTTP request issues, make HTTP request testing more specific?

gábor hojtsy’s picture

Status: Active » Postponed (maintainer needs more info)
andrewmacpherson’s picture

Status: Postponed (maintainer needs more info) » Active

I updated to 8.x-2.2 today and soon encountered this error. I have drupal/upgrade_status as a require-dev dependency of my project, but the module isn't actually enabled most of the time. (It's disabled on production, and I list it among $settings['config_exclude_modules']).

I encountered the bug during drush config-import -y. The Upgrade Status module wasn't enabled at the time. I also encountered it during drush updb like @hunterbuchanan found.

I tried the patch from #3126600-2: Upgrade status scans fail with error 500 due to HTTP request issues, make HTTP request testing more specific as you suggest, and the problems went away. The following all succeeded:

  • drush config-import
  • drush updb
  • drush us-a
  • drush us-cs
  • Scanning modules in the Upgrade Status UI at admin/reports/upgrade-status

composer why php says I don't have anything which requires PHP 7.3 in my Composer project.

I use Docksal as my local dev environment. My linux host has PHP 7.3, but the Docksal container has PHP 7.2. Running rm -rf ./vendor && composer install works regardless of whether I run it on the host or inside the container.

Note that the Drush commands I mentioned above were running inside the Docksal container via fin drush ..., i.e. they succeeded with the container's PHP 7.2.

My Drupal core version is 8.8.5.

gábor hojtsy’s picture

Title: Upgrade Status 8.x-2.2 seems to require PHP 7.3+ but Composer allows install on older versions » Argument 1 passed to ThemeFunctionDeprecationAnalyzer::__construct() must be an instance of Container

gábor hojtsy’s picture

gábor hojtsy’s picture

  • Gábor Hojtsy committed be7dc47 on 8.x-2.x
    Issue #3126770 by Gábor Hojtsy, hunterbuchanan, andrewmacpherson, floown...
gábor hojtsy’s picture

Status: Active » Fixed

Committed the fix from #3126600: Upgrade status scans fail with error 500 due to HTTP request issues, make HTTP request testing more specific for this issue, given that there is still outstanding problems there to resolve the original scope there. Thanks for all the reports and verification. Especially @andrewmacpherson for your detailed report. Planning to release this soon, ideally with the remaining scope of #3126600: Upgrade status scans fail with error 500 due to HTTP request issues, make HTTP request testing more specific resolved and #3126949: Missing requirement in composer.json should not generate a warning.

hunterbuchanan’s picture

Thanks to everyone for looking into this! Admittedly, I made the assumption that PHP 7.2 vs 7.3 was part of the issue because our developer said he saw "PHP version should be at least 7.3.0" somewhere in the interface. Regardless, we'll update to the latest dev, I'm guessing it will work fine, and I look forward to seeing that fix included in a new version release in the near future. If I still see a problem with the dev version, I'll let you know right away.

Sorry about the red herring in the original title!

Status: Fixed » Closed (fixed)

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