After each an every try to update a particular Magento 2.2.5 installation (CE) to 2.2.6 we get the following error:
PHP message: PHP Fatal error: Uncaught Error: Call to undefined method Magento\Catalog\Model\View\Asset\ImageFactory::create() in [...]/vendor/magento/module-catalog/Model/Product/Image.php:403 Stack trace: #0 [...]/vendor/magento/module-catalog/Helper/Image.php(500): Magento\Catalog\Model\Product\Image->setBaseFile('/0/1/0100stsc06...') #1 [...]/vendor/magento/module-catalog/Helper/Image.php(470): Magento\Catalog\Helper\Image->initBaseFile() #2 [...]/vendor/magento/module-catalog/Helper/Image.php(528): Magento\Catalog\Helper\Image->applyScheduledActions() #3 [...]/app/design/frontend/Smartwave/porto/Smartwave_Filterproducts/templates/owl_list.phtml(74): Magento\Catalog\Helper\Image->getUrl() #4 [...]/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/home/myproabr/...') #5 [...]/vendor/magento/framework/...
These are the commands we executed for the update:
bin/magento maintenance:enable composer require magento/product-community-edition 2.2.6 --no-update composer update -o rm -rf var/cache/* var/log/* var/page_cache/* generated/ bin/magento cache:clean bin/magento cache:flush bin/magento setup:upgrade bin/magento setup:di:compile bin/magento indexer:reindex bin/magento maintenance:disable
Each and every step, including
setup:di:compile, ran without any errors. However, when opening the front end, the aforementioned error is thrown. The back end works fine.
If you analyse the error message you'll see that the code requires a class called
Magento\Catalog\Model\View\Asset\ImageFactory. This class does not exist by default but is instead generated as a proxy or interceptor on the fly - or during
However, when inspecting the
generated/ folder, we can see that there is in fact no file called
generated/code/Magento/Catalog/Model/View/Asset/ImageFactory.php. However, that file should have been created there (it is there in the 2.2.5 backup for example).
And it's not just this particular class that is missing. There are actually a lot of files missing in the
generated/ folder, judging by the comparison to a working 2.2.5 installation.
So it seems for some reason Magento is unable to identify all required classes for dependency injection - or something similar. Since the file is neither created on demand, nor during
setup:di:compile. But what could be the reason for that?