7

I have few extensions which is using "Zend_Http_Client". It is working with Magento ver. 2.4.5. but in Magento 2.4.6, it says "Error: Class "Zend_Http_Client" not found".

6 Answers 6

23

As Zend usage deprecated since 2.4.6, Now you can use Laminas instead.

  • Replace Zend_Http_Client with \Laminas\Http\Request (Replace constants from GET to METHOD_GET, POST to METHOD_POST)

  • For example: \Zend_Http_Client::POST will be \Laminas\Http\Request::METHOD_POST and \Zend_Http_Client::GET will be \Laminas\Http\Request::METHOD_GET

  • Replace Zend_Json with \Laminas\Json\Json

Make sure that you have installed

  • laminas/laminas-http
  • laminas/laminas-serializer

More information can be found here: https://developer-stage.adobe.com/commerce/php/development/backward-incompatible-changes/highlights/?utm_source=store&utm_medium=blog&utm_campaign=2023-02-magento-2-4-6

0
5

You can resolve this (for the time being) by adding magento/zendframework1 back into your build.

composer require magento/zendframework1

Then do a full clean and it should all work again.

3
  • 1
    If I could give 1000 points right now I would. Thank you. I wonder why Magento didn't advertise this very easy workaround, than to wait the module developers to provide the adapted releases without Zend_* dependencies. Commented Mar 31, 2023 at 17:58
  • it is a good solution after it reaches it's EOL ?
    – Ahmed Atef
    Commented Apr 26, 2023 at 10:24
  • 1
    Don't use deprecated framework. It's bad idea, guys Commented Jul 20, 2023 at 13:00
2

Zend framework (ZF1) components that have reached end of life have been removed from the codebase. See Backward-incompatible changes highlights.

1

Zend has been replaced by Laminas. Be sure ton include laminas/laminas-serializer in composer.json

0

You need to install laminas/laminas-serializer via composer

composer require laminas/laminas-serializer

and then replace Zend classes with respective Laminas classes from your code inside vndor directory and app/code and all other occurences.

Follow this article for more details: https://meetanshi.com/blog/solved-class-zend-not-found-in-magento-2/

0

There are official docs with official suggestions (with examples):

Zend_HTTP replaced with laminas-http https://developer.adobe.com/commerce/php/development/backward-incompatible-changes/highlights/#zend_http-replaced-with-laminas-http

Zend_Validate replaced with laminas-validator https://developer.adobe.com/commerce/php/development/backward-incompatible-changes/highlights/#zend_validate-replaced-with-laminas-validator

Replace Zend_Http_Client class: In your case you can use \Magento\Framework\HTTP\LaminasClient instead of ancient Zend_Http_Client

Another idea: Try to avoid direct usage of 3d-party classes like Zend or Laminas. In Magento we should use Adapters - as a Magento best practice

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.