Magento 2.4.3 version has been released on 10th August 2021, for both Commerce/Cloud and Open Source editions.

After upgrading to Magento 2.4.3 you may have Class "Zend\Serializer\Serializer" not found or "Zend\Serializer\Adapter\PhpSerialize" not found errors on some of your third party extensions that use "Zend\Serializer\Serializer" or "Zend\Serializer\Adapter\PhpSerialize" classes.

What Is The Cause?

The cause is that "laminas/laminas-serializer" package is missing in Magento 2.4.3 composer.json by default. This package along with other laminas packages that were on Magento 2.4.2 has been removed in Magento 2.4.3 composer.json.

Also, in Magento 2.4.3, laminas library dependencies have been upgraded to the versions compatible with PHP 8.x, and some redundant dependencies including laminas packages have been removed from Magento 2.4.3 composer.json file.

If you compare both Magento 2.4.2 and Magento 2.4.3 composer.json files you will see the differences.

Here are laminas packages in Magento 2.4.2 composer.json file:

"laminas/laminas-captcha": "^2.7.1",
"laminas/laminas-code": "~3.4.1",
"laminas/laminas-config": "^2.6.0",
"laminas/laminas-console": "^2.6.0",
"laminas/laminas-crypt": "^2.6.0",
"laminas/laminas-db": "^2.8.2",
"laminas/laminas-dependency-plugin": "^1.0 || ^2.0",
"laminas/laminas-di": "^2.6.1",
"laminas/laminas-eventmanager": "^3.0.0",
"laminas/laminas-feed": "^2.9.0",
"laminas/laminas-form": "^2.10.0",
"laminas/laminas-http": "^2.6.0",
"laminas/laminas-i18n": "^2.7.3",
"laminas/laminas-json": "^2.6.1",
"laminas/laminas-log": "^2.9.1",
"laminas/laminas-mail": "^2.9.0",
"laminas/laminas-mime": "^2.5.0",
"laminas/laminas-modulemanager": "^2.7",
"laminas/laminas-mvc": "~2.7.0",
"laminas/laminas-serializer": "^2.7.2",
"laminas/laminas-server": "^2.6.1",
"laminas/laminas-servicemanager": "^2.7.8",
"laminas/laminas-session": "^2.7.3",
"laminas/laminas-soap": "^2.7.0",
"laminas/laminas-stdlib": "^3.2.1",
"laminas/laminas-text": "^2.6.0",
"laminas/laminas-uri": "^2.5.1",
"laminas/laminas-validator": "^2.6.0",
"laminas/laminas-view": "~2.11.2",

Here are laminas packages in Magento 2.4.3 composer.json file:

"laminas/laminas-captcha": "^2.10",
"laminas/laminas-code": "^3.5.1",
"laminas/laminas-crypt": "^3.4.0",
"laminas/laminas-db": "^2.12.0",
"laminas/laminas-dependency-plugin": "^2.1.0",
"laminas/laminas-di": "^3.2.0",
"laminas/laminas-eventmanager": "^3.0.0",
"laminas/laminas-escaper": "2.7.0",
"laminas/laminas-feed": "^2.13.0",
"laminas/laminas-filter": "^2.11",
"laminas/laminas-http": "^2.6.0",
"laminas/laminas-i18n": "^2.7.3",
"laminas/laminas-json": "^3.2.0",
"laminas/laminas-mail": "^2.9.0",
"laminas/laminas-mime": "^2.8.0",
"laminas/laminas-modulemanager": "^2.7",
"laminas/laminas-mvc": "^3.2.0",
"laminas/laminas-server": "^2.6.1",
"laminas/laminas-servicemanager": "^3.6.0",
"laminas/laminas-session": "^2.10",
"laminas/laminas-soap": "^2.9.0",
"laminas/laminas-stdlib": "^3.2.1",
"laminas/laminas-text": "^2.6.0",
"laminas/laminas-uri": "^2.5.1",
"laminas/laminas-validator": "^2.6.0",
"laminas/laminas-view": "~2.12.0",

How To Fix This Issue?

If you still want to keep using 'Zend\Serializer\Serializer' class in your third-party extensions, the quick fix there is to install laminas/laminas-serializer package

Run the followings command to install laminas/laminas-serializer

composer require laminas/laminas-serializer --no-update
composer update
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento setup:di:compile
php bin/magento cache:flush

The php bin/magento setup:static-content:deploy command deploy the default locale which is en_US. If you have more locales, eg. nl_NL, fr_FR, make sure to includes them in the deploy command as follow: php bin/magento setup:static-content:deploy en_US nl_NL fr_FR

The Class "Zend\Serializer\Serializer" not found or "Zend\Serializer\Adapter\PhpSerialize" not found errors will be fixed.

Conclusion

We hope you find this fix helpful. Feel free to share or leave a comment below. Your opinion is much appreciated!

If you're looking for experienced Magento 2 developers to customize your site, fix issues, develop custom solutions, or anything else, feel free to check on this collection of Quality Services For Magento 2, choose the service that best suits your needs, or contact us

Tags: magento-2-backend-development