0

After upgrading to Magento 2.3.5-P1, I start getting below error. Any help would be appreciated!

{"messages":{"error":[{"code":500,"message":"Fatal Error: 'Cannot declare class Zend_Http_Client, because the name is already in use' in '/var/www/html/project/vendor/magento/zendframework1/library/Zend/Http/Client.php' on line 72","trace":"Trace is not available."}]}}

enter image description here

1
  • Are you using core Magento email or a third-party SMTP extension to send emails? Commented May 12, 2020 at 20:25

4 Answers 4

9

UPDATE: @Renon Steward's answer fixed the issue

Try open composer.json and remove use-include-path or the entire config element if this is the only entry.

"config": {
    "use-include-path": true
},

use-include-path - Defaults to false. If true, the Composer autoloader will also look for classes in the PHP include path.

After alot of digging it seems to be a bug with magento and laminas framework (formerly known as Zend)

Some modules (alot of them) are still using Zend\… namespace. They are now replaced with Laminas\… namespace. To fix this issue, Laminas created a bridge composer module to add autoloads that create alias for everything Zend\… to Laminas\… https://getlaminas.org/blog/2020-03-09-transferring-zf-to-laminas.html

This works very well... EXCEPT: the problem is it interferes with old zf1 classes still used by Magento.

For example, the code uses \Zend\Http\Client (PSR-4 ZF2)… composer autoload will return Zend_Http_Client (PSR-0 ZF1) When this occurs, the Laminas bridge autoload is cancelled and will not return Laminas\Http\Client

It will happen whenever a module is calling a Zend class that has similar autoload path in ZF1.

Another example here https://github.com/magepal/magento2-gmail-smtp-app/issues/168

For now, I'll stick to Magento 2.3.4-p2 upgrade

4

This issue seems to only affect users upgrading from a previous version of Magento 2.

Try open composer.json and remove use-include-path or the entire config element if this is the only entry.

    "config": {
        "use-include-path": true
    },

use-include-path - Defaults to false. If true, the Composer autoloader will also look for classes in the PHP include path.

If you are still having issues try downloading a fresh copy of v2.3.5 and do a diff of both composer.* file against the core Magento (you will need to figure out what are core changes vs local store only changes).

0

Had a similar issue, check your PHP version should be 7.2 or 7.3

1
0

Did you install 2.3.5 and later applied p1 patch? Did you try removing generated and vendor and re-do composer update, setup:up and static deploy?

error alone won't give much to think about the problem. However php bug existed for something like this long ago. https://bugs.php.net/bug.php?id=66773

1
  • Yes,I upgrade 2.3.5 first and then applied P1. Commented May 12, 2020 at 19:40

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.