Skip to content

Error when upgrading from 1.7.4.x and previous to 1.7.7.0 Stable 2 Build #22141

Closed
Listed in
@Robin-Fischer-PS

Description

@Robin-Fischer-PS
Contributor

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:

  1. 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)
  2. Upload autoupgrade module (v4.10.1)
  3. Make the upgrade using "Local Archive" and the 1.7.7.0 Stable 2 Build
  4. 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

added
BugType: Bug
CriticalSeverity: critical bug > https://build.prestashop.com/news/severity-classification
ReadyStatus: Issue is ready to be worked on
on Nov 27, 2020
added
Must-haveKanban prioritization: issue must be included in next version
on Nov 27, 2020
added this to the 1.7.7.0 milestone on Nov 27, 2020
PierreRambaud

PierreRambaud commented on Nov 27, 2020

@PierreRambaud
Contributor

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 a glob, the controller is not available because not register in the autoloader and we provide an optimize composer autoload.

Two possible solutions:

  • Remove an optimized option for the composer to keep the fallback usage.
  • Use whitelist instead of a glob and register all our controllers manually
jolelievre

jolelievre commented on Nov 27, 2020

@jolelievre
Contributor

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

PierreRambaud commented on Nov 27, 2020

@PierreRambaud
Contributor

I confirm removing the classmap-authoritative make it works

34 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

1.7.7.xBranchAutoupgradeModule: autoupgradeBugType: BugCriticalSeverity: critical bug > https://build.prestashop.com/news/severity-classificationFixedResolution: issue closed because fixedMust-haveKanban prioritization: issue must be included in next versionPR availableSolution: issue is being addressedRegressionType: regression

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @PierreRambaud@Progi1984@atomiix@dulismo@matks

    Issue actions

      Error when upgrading from 1.7.4.x and previous to 1.7.7.0 Stable 2 Build · Issue #22141 · PrestaShop/PrestaShop