magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.54k stars 9.32k forks source link

After Downgrading from 2.3.5-p1 to 2.3.4, I cannot run bin/magento (An abstract factory could not create an instance of magentoframeworkappdeploymentconfig(alias: Magento\Framework\App\DeploymentConfig).) #28697

Closed grichards closed 4 years ago

grichards commented 4 years ago

Preconditions (*)

  1. 2.3.4
  2. After downgrading from 2.3.5-p1

Steps to reproduce (*)

  1. Have 2.3.4
  2. Upgrade to 2.3.5-p1
  3. Downgrade to 2.3.4
  4. Try to run bin/magento

Expected result (*)

  1. Get a list of command options.

Actual result (*)

  1. An abstract factory could not create an instance of magentoframeworkappdeploymentconfig(alias: Magento\Framework\App\DeploymentConfig).

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 4 years ago

Hi @grichards. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


VadimLugovoy commented 4 years ago

Have found a manual solution to fix this. there needs to be removed laminas folder from vendor directory and also vendor/bin/templatemap_generator.php file (cause it`s a hyper link to some file inside previous laminas folder). then run composer install , that there will be created zendframework inside vendor folder and all will work

The core of the issue that 2.3.5 version migrates to laminas framework (renamed Zend) and 2.3.4 failed to load Zend files (cause they are located in laminas folder). Something like this :)

DuckThom commented 4 years ago

I ran into the same issue earlier this month. I solved it by removing my vendor folder and running composer install again.

As @VadimLugovoy pointed out, laminas is the main issue. It's marked as a replacement for the zendframework packages in composer but the laminas packages are not providing the same namespace for the zend classes. So while composer thinks it can keep, for example, laminas/laminas-mvc as a replacement for zendframework/zend-mvc, any code looking for a class in the Zend\Mvc namespace will error out as all the namespaces have been renamed to Laminas\Mvc.

A workaround would be to add the laminas packages as a conflict in your main composer.json like so:

{
    "conflict": {
        "laminas/laminas-mvc": "*"
    }
}

Just remember to remove those when you upgrade Magento again.

grichards commented 4 years ago

Thanks for your comments @VadimLugovoy and @DuckThom.

After I remove vendor and or only vendor/laminas, then run composer install... the laminas folders just reinstall themselves, despite my having switched my magento version in composer.json down to 2.3.4.

grichards commented 4 years ago

Looks like I had to run composer update instead of install after removing /vendor... I wonder why.

ihor-sviziev commented 4 years ago

@grichards you have to remove /vendor directory as downgrading sometimes fails when vendor folder exists (bug might not fail), also you need to update your composer.lock (using composer update), as composer install command just reads and installs what package versions you have in the composer.lock file.

DuckThom commented 4 years ago

Looks like I had to run composer update instead of install after removing /vendor... I wonder why.

Ah yes, now that you mention it, it was a composer update that fixed it for me aswell.

To me, it mainly looks like an issue with laminas as the packages are currently marked as being a "drop-in replacement" but the different namespaces are causing it to break if not all zendframework packages are replaced with their laminas alternatives.

grichards commented 4 years ago

As there is a work around, I'll close this.

m2-assistant[bot] commented 4 years ago

Hi @ihor-sviziev. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down: