Closed
Description
Describe the bug
Using 1 click upgrade module, there is an error when upgrading from 1.7.4.4 to 1.7.7.0 Build Stable 2. This happens with fresh install, and with PHP 7.1 and 7.2.
The autoupgrade module version used is v4.10.1.
Upgrade from 1.7.3.3 to 1.7.7.0 is KO.
Upgrade from 1.7.4.2 to 1.7.7.0 is KO.
Upgrade 1.7.4.4 to 1.7.6.9 is OK.
This was reproduced by @khouloudbelguith and @sarahdib .
Expected behavior
Upgrade should be fine.
Steps to Reproduce
Steps to reproduce the behavior:
- Install 1.7.4.4 version of PrestaShop (the bug also happens with 1.7.4.2 version and probably all 1.7.4 versions)
- Upload autoupgrade module (v4.10.1)
- Make the upgrade using "Local Archive" and the 1.7.7.0 Stable 2 Build
- There is the following error during the upgrade
[INTERNAL] /projet/1744/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php line 168 - Symfony\Component\Config\Exception\FileLoaderLoadException: Expected to find class "PrestaShopBundle\Controller\Admin\Improve\AddonsStoreController" in file "/projet/1744/src/PrestaShopBundle/Controller/Admin/Improve/AddonsStoreController.php" while importing services from resource "/projet/1744/app/../src/PrestaShopBundle/Controller/*", but it was not found! Check the namespace prefix used with the resource in /projet/1744/app/config/config.yml (which is being imported from "/projet/1744/app/config/config_prod.yml").
#0 /projet/1744/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php(90): Symfony\Component\Config\Loader\FileLoader->doImport('/projet/1744/ap...', NULL, false, '/projet/1744/ap...')
#1 /projet/1744/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php(195): Symfony\Component\Config\Loader\FileLoader->import('config.yml', NULL, false, '/projet/1744/ap...')
#2 /projet/1744/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php(127): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->parseImports(Array, '/projet/1744/ap...')
#3 /projet/1744/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/DelegatingLoader.php(40): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->load('/projet/1744/ap...', NULL)
#4 /projet/1744/app/AppKernel.php(151): Symfony\Component\Config\Loader\DelegatingLoader->load('/projet/1744/ap...')
#5 /projet/1744/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(776): AppKernel->registerContainerConfiguration(Object(Symfony\Component\Config\Loader\DelegatingLoader))
#6 /projet/1744/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(642): Symfony\Component\HttpKernel\Kernel->buildContainer()
#7 /projet/1744/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(135): Symfony\Component\HttpKernel\Kernel->initializeContainer()
#8 /projet/1744/modules/autoupgrade/classes/UpgradeTools/SymfonyAdapter.php(74): Symfony\Component\HttpKernel\Kernel->boot()
#9 /projet/1744/modules/autoupgrade/classes/UpgradeTools/CoreUpgrader/CoreUpgrader17.php(50): PrestaShop\Module\AutoUpgrade\UpgradeTools\SymfonyAdapter->initAppKernel()
#10 /projet/1744/modules/autoupgrade/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php(85): PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader17->initConstants()
#11 /projet/1744/modules/autoupgrade/classes/TaskRunner/Upgrade/UpgradeDb.php(41): PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader->doUpgrade()
#12 /projet/1744/admin-dev/autoupgrade/ajax-upgradetab.php(53): PrestaShop\Module\AutoUpgrade\TaskRunner\Upgrade\UpgradeDb->run()
#13 {main}
Screenshots
https://drive.google.com/file/d/1KVuPaRsvJS368giDjj9c70gML_SMxbrm/view
Additional information
- PrestaShop version: presta1770stable2
- PHP version: 7.1 and 7.2
Activity
PierreRambaud commentedon Nov 27, 2020
We found the source of the problem, it's because of this pull request: #18475
The previous version had controllers that are now removed or moved to a new directory. In my case, it's the
PrestaShopBundle\Admin\ModuleController
which is not available.The block trying to auto-wire controllers is fetching the whole directory in
src/PrestaShopBundle/Controller/*
with aglob
, the controller is not available because not register in the autoloader and we provide an optimize composer autoload.Two possible solutions:
jolelievre commentedon Nov 27, 2020
I'd go for the quick fix to patch the 177 build (disable
classmap-authoritative
when building composer autoload)It should also fix other issues when a shop has been modified and other controller and services have been added (but are not mapped) And it has few to none drawback since it only slows down the autoload when the class is not found in the static classmap
PierreRambaud commentedon Nov 27, 2020
I confirm removing the
classmap-authoritative
make it works34 remaining items