I am facing after an issue after upgrading version magneto 2.4.3 to 2.4.5 When I run this command I got error

php bin/magento setup:di:compile

Deprecated Functionality: Return type of Zend_Config::count() should either be compatible with Countable

enter image description here

  • Can you please tell us that your magento 2.4.5 is running fine or not. I want to use Magento 2.4.5 for my site?
    – Rana Zain
    Oct 21, 2022 at 12:58

1 Answer 1


You should upgrade again because your upgrade failed.

Solution 1: Update the composer.json file specifically the require-dev section with what is written here https://github.com/magento/magento2/blob/2.4.5/composer.json

Then remove vendor folder and run the following commands:

composer install
bin/magento setup:upgrade
bin/magento setup:di:compile

Solution2: Do the following steps:

  1. STAY IN PHP 7.4
  2. composer require magento/composer-root-update-plugin ~2.0 --no-update
  3. composer update
  4. rm -rf var/cache/* var/page_cache/* generated/code/* ; bin/magento setup:upgrade
  5. composer require-commerce magento/product-community-edition 2.4.5 --no-update
  6. composer update
  7. CHANGE TO PHP 8.1
  8. rm -rf var/cache/* var/page_cache/* generated/code/* ; bin/magento setup:upgrade; bin/magento setup:di:compile

Reference: https://github.com/magento/magento2/issues/35306

  • I did but got same error again
    – kiran
    Oct 11, 2022 at 13:11
  • I've updated the answer, please check.
    – Tu Van
    Oct 11, 2022 at 13:29
  • I tried both solutions but got same an error
    – kiran
    Oct 11, 2022 at 14:14
  • You can take a look at the github issue, some suggestion there maybe help you: github.com/magento/magento2/issues/35306
    – Tu Van
    Oct 19, 2022 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.