I upgraded from 2.4.2 to 2.4.4. Everything seemed to work, until I ran setup:di:compile. I get this error:

 MiBClass 'Zend\I18n\Validator\PhoneNumber' not found#0 /var/www/html/magento2/vendor/composer/ClassLoader.php(571): include()
#1 /var/www/html/magento2/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#3 [internal function]: spl_autoload_call()
#4 /var/www/html/magento2/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(134): class_exists()
#5 /var/www/html/magento2/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass()
#6 /var/www/html/magento2/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract()
#7 /var/www/html/magento2/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php(61): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList()
#8 /var/www/html/magento2/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation()
#9 /var/www/html/magento2/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process()
#10 /var/www/html/magento2/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute()
#11 /var/www/html/magento2/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#12 /var/www/html/magento2/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#13 /var/www/html/magento2/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun()
#14 /var/www/html/magento2/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun()
#15 /var/www/html/magento2/bin/magento(23): Symfony\Component\Console\Application->run()
#16 {main}

I haven't found any answers by searching, and I'm not sure where to look - can anybody give me any pointers?


  • Hi there, this error is coming from the classLoader, please try removing this directory vendor/composer and run the composer install command again, removing this directory is reversible again with the install command so don't worry, please do reply in case of any other issues.Thanks Jul 26, 2022 at 5:19

6 Answers 6


I edited /var/www/html/magento2/vendor/composer/ClassLoader.php and added the line "echo $file . PHP_EOL;" to the includeFile function.

Then i ran setup:di:compile again. This showed be the file that was causing the problem. There was a class in my Mageplaza Giftcard extension that was extending a class from Zend, which is no longer present in Magento 2.4.4

I will contact Mageplaza to let them know and see what the solution is. But for now, I think that was the solution to this issue.

Thank you for your help!


Need to require Laminas i18n which was removed with 2.4.4 release.

composer require laminas/laminas-i18n

  • This is the correct answer
    – Dasun
    Sep 3, 2022 at 20:22

The issue is from the vendor files especially in the composer auto-loaded. Install the composer module then change the file permission once again as per the magento prerequisites

Run the below command in the Magento root directory

  1. Install composer modules
 composer install
  1. File permissions
sudo find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
    sudo find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
    sudo usermod -a -G www-data $USER
    sudo find . -type d -exec chmod 0770 {} \; -print && sudo find . -type f -exec chmod 0660 {} \; -print
    sudo find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; -print
    sudo find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; -print
    sudo chown -R :www-data .
    sudo chmod u+x bin/magento

You have to upgrade your composer version from one to two.

sudo composer self-update --2

you have to sure to remove all modules from the vendor folder before updating itto new Magento version. I suspect some files are hanging in IDE or Docker sync.

So: rm -rf vendor/* && composer update/install.


I've had a lot of trouble with this in 2.4.5-p1. What fixed it for me was changing "optimize-autoloader" to false, then running composer dumpautoload

   "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": false,

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.