Skip to content

Upgrade from 2.4.3-p1 to 2.4.4 throws terminal error "Fatal error: During inheritance of Countable" #35306

@FadedOut

Description

@FadedOut

UPDATE: THANKS to @loic-paquin for helping pinpoint a change in process with upgrading to 2.4.4. Please see comment 7 for solution!

Preconditions (*)

  1. Magento 2.4.3-p1
  2. Production Mode
  3. Apache 2.4 (no NGINX)
  4. mod_mpm_worker
  5. PHP 7.4.23
  6. Elasticsearch 7.12.1
  7. Redis 6.2.6
  8. MariaDB 10.3.34
  9. Composer 2.1.6 (then upgraded to 2.3.5 because of the errors below thinking this would help but it made no difference)
  10. RabbitMQ 3.9.14
  11. PHP-FPM: on
  12. PHP Handler: fcgi
  13. Followed: https://devdocs.magento.com/guides/v2.4/install-gde/prereq/php-settings.html

Steps to reproduce (*)

These are the steps I did (in this exact order) then receive the error shown below (in terminal). M2.4.3-p1 worked fine btw.

  1. I was on PHP 7.4.23 - I changed to PHP 8.1.4
  2. Ran the following:
  • composer require magento/product-community-edition 2.4.4 --no-update
  • composer require magento/composer-root-update-plugin ~2.0 --no-update
  • composer upgrade
  1. It appeared to complete the files to download/update because it displayed the "generating autoload files" and "funding" lines at the end (no errors).
  2. I tried running "rm -rf var/cache/* ; rm -rf var/page_cache/* ; rm -rf generated/code/* ; bin/magento setup:upgrade"

Expected result (*)

  1. Magento 2.4.4 to work as intended.

Actual result (*)

  1. After running "step 4" above, it simply throws the error shown below. No magento command works - the only command that works is "composer upgrade".

Can't run any of the following without error (with or without php before command):

  • bin/magento maintenance:disable
  • bin/magento setup:upgrade
  • bin/magento setup:di:compile
  1. Error Report:
    ----ERRORS SHOWN IN CONSOLE/TERMINAL (when executing any command with PHP 8.1)-----
Fatal error: During inheritance of Countable: Uncaught Exception: Deprecated Functionality: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/*****/public_html/vendor/composer/composer/src/Composer/Repository/ArrayRepository.php on line 277 in /home/*****/public_html/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 /home/*****/public_html/vendor/composer/composer/src/Composer/Repository/ArrayRepository.php(28): Magento\Framework\App\ErrorHandler->handler(8192, 'Return type of ...', '/home/*****/publi...', 277)
#)1 /home/*****/public_html/vendor/composer/ClassLoader.php(571): include('/home/*****/publi...')
#)2 /home/*****/public_html/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/home/*****/publi...')
#)3 /home/*****/public_html/vendor/composer/composer/src/Composer/Repository/PlatformRepository.php(31): Composer\Autoload\ClassLoader->loadClass('Composer\\Reposi...')
#)4 /home/*****/public_html/vendor/composer/ClassLoader.php(571): include('/home/*****/publi...')
#)5 /home/*****/public_html/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/home/*****/publi...')
#)6 /home/*****/public_html/vendor/composer/composer/src/Composer/Package/Loader/ValidatingArrayLoader.php(375): Composer\Autoload\ClassLoader->loadClass('Composer\\Reposi...')
#)7 /home/*****/public_html/vendor/composer/composer/src/Composer/Package/Loader/RootPackageLoader.php(70): Composer\Package\Loader\ValidatingArrayLoader::hasPackageNamingError('magento/project...')
#)8 /home/*****/public_html/vendor/composer/composer/src/Composer/Factory.php(368): Composer\Package\Loader\RootPackageLoader->load(Array, 'Composer\\Packag...', '/home/*****/publi...')
#)9 /home/*****/public_html/vendor/composer/composer/src/Composer/Factory.php(595): Composer\Factory->createComposer(Object(Composer\IO\BufferIO),Array, false)
#)10 /home/*****/public_html/vendor/magento/framework/Composer/ComposerFactory.php(47): Composer\Factory::create(Object(Composer\IO\BufferIO), '/home/*****/publi...')
#)11 /home/*****/public_html/vendor/magento/framework/Composer/ComposerInformation.php(368): Magento\Framework\Composer\ComposerFactory->create()
#)12 /home/*****/public_html/vendor/magento/framework/Composer/ComposerInformation.php(381): Magento\Framework\Composer\ComposerInformation->getComposer()
#)13 /home/*****/public_html/vendor/magento/framework/Composer/ComposerInformation.php(244): Magento\Framework\Composer\ComposerInformation->getLocker()
#)14 /home/*****/public_html/vendor/magento/framework/App/ProductMetadata.php(120): Magento\Framework\Composer\ComposerInformation->getSystemPackages()
#)15 /home/*****/public_html/vendor/magento/framework/App/ProductMetadata.php(80): Magento\Framework\App\ProductMetadata->getSystemPackageVersion()
#)16 /home/*****/public_html/vendor/magento/framework/Console/Cli.php(98): Magento\Framework\App\ProductMetadata->getVersion()
#)17 /home/*****/public_html/bin/magento(22): Magento\Framework\Console\Cli->__construct('Magento CLI')
#)18 {main} in /home/*****/public_html/vendor/composer/composer/src/Composer/Repository/ArrayRepository.php on line 28

-------ERROR SHOWN IN SYSTEM.LOG (when executing: php bin/magento setup:upgrade with PHP 7.4)-------
main.CRITICAL: Type Error occurred when creating object: Magento\Framework\Communication\Config\Data, Magento\Framework\Reflection\TypeProcessor::resolveFullyQualifiedClassName(): Argument #2 ($typeName) must be of type string, null given, called in /home/*****/public_html/vendor/magento/framework/Reflection/TypeProcessor.php on line 550


I apologize if I did something wrong. I don't wish to waste anyone's time. I've spent hours trying to figure out why it's doing this before posting this report, to try and make sure it's not on my end. And I tried researching and there isn't much on this. Hopefully the error log points to a bug.

EDIT: Updated my command processes - with same outcome. Just to clarify.
EDIT2: Learning more as I keep trying. Something is up with the PHP changes in Magento I think,
EDIT3: Solution info added to top of OP


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • [-] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

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