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

  • Are you using core Magento email or a third-party SMTP extension to send emails? – Renon Stewart May 12 at 20:25
6

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

| improve this answer | |
1

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).

| improve this answer | |
0

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

| improve this answer | |
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

| improve this answer | |
  • Yes,I upgrade 2.3.5 first and then applied P1. – Abhishek Panchal May 12 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.