Solved: Class Zend Not Found in Magento 2 – Fix All Zend Errors
Facing issues related to Zend Class not found in Magento 2 after an upgrade?
You’re not alone. A lot of other people have reported the same issue after the Magento 2.4.6 upgrade.
That’s because Magento has deprecated the Zend Framework from its codebase.
On March 14, 2023, Adobe rolled out the Magento 2.4.6 release with over 300 quality fixes and platform enhancements. One of the major backward-incompatible changes introduced in the release was the deprecation of the Zend framework from the codebase.
The Zend classes in the Magento 2 core code have been replaced with the Laminas.
However, they may still be present in the third-party modules and throw errors.
Some of the common errors include:
- Error: Class Zend_Json not found
- Error: Class Zend_Http_Client not found
- Error: Class Zend_Filter not found
- Error: Class Zend_Validate not found
You can use the solution provided below for any Class Zend not found in Magento 2.
Here’s how to solve this. 👇
Method to Solve ‘Error Class Zend not found’ in Magento 2
In order to solve the Class Zend not found exception in Magento 2, you need to replace the Zend classes with the Laminas.
Follow these steps:
Step 1: Install Laminas
First of all, you need to install the laminas/laminas-serializer
in Magento 2. You can install it by using the following command in the terminal:
composer require laminas/laminas-serializer
Step 2: Replace Zend Classes with Laminas
Once the Laminas is installed, you need to replace the Zend classes with it.
- Open the
.phtml
file where you are facing the main.CRITICAL: Error: Class Zend not found in Magento 2. - Find and replace the respective Zend classes with that of Laminas as provided in the table below:
Zend Classes
Laminas Classes
\Zend_Http_Client::POST \Laminas\Http\Request::METHOD_POST \Zend_Http_Client::GET \Laminas\Http\Request::METHOD_GET \Zend_Json \Laminas\Json\Json \Zend_Filter laminas-filter \Zend_HTTP laminas-http \Zend_Validate laminas-validator - Save the file.
You can use the find-and-replace functionality of the code editors to do this.
Repeat the above steps to replace the Zend classes for all the third-party modules to prevent the error.
Conclusion
The official Zend Framework has rebranded as the Laminas Project over to the Linux foundation. Therefore, Adobe has also replaced the Zend Framework with Laminas in the core code of Magento and Adobe Commerce. The third-party module needs to be upgraded to the Laminas as well to prevent the main.CRITICAL: Error: Class Zend not found exception in Magento 2.
I hope the above-provided steps will help you solve the Class Zend not found error in Magento 2.
In case, you are still facing the issue, feel free to comment. I would be happy to help you.
Problem solved? Spread the knowledge. Share this solution with your friends via social media.
Thank You! 🍀
Still need help? Hire our Adobe-certified Magento experts.
4 Comments
In smtp extension class Transport extends \Zend_Mail_Transport_Smtp implements TransportInterface which Laminas Classe use.?
Hey Nabeel,
In the extension class Transport extends \Zend_Mail_Transport_Smtp
Replace it with Laminas\Mail\Transport\Smtp
https://drops.meetanshi.com/i/ENRPdk
Thankyou Meetanshi team. I have solved my issue.
Thank You! We Feel Grateful Naeemakhtar.