Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated Functionality: Zend_Http_UserAgent_Mobile implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) #49

Open
manan-india opened this issue Jun 23, 2022 · 3 comments

Comments

@manan-india
Copy link

manan-india commented Jun 23, 2022

When calling the match($userAgent, $server) function for mobile view in the module, it is giving error

PHP: 8.1
Magento: 2.4.4

Screenshot from 2022-06-23 18-18-48

@xmav
Copy link

xmav commented Jun 23, 2022

Hi! Could you please share more detailed steps to reproduce ?

@manan-india
Copy link
Author

Hello!

We have called the function of class(path: vendor/magento/zendframework1/library/Zend/Http/UserAgent/Mobile.php on line 33): This class is implementing the Serializable interface and it is deprecated in PHP 8.1: https://php.watch/versions/8.1/serializable-deprecated.
Implementation:

    public function isMobileDevice()
    {
        $userAgent = $this->httpHeader->getHttpUserAgent();
        $server = $this->getRequest()->getServer();
        $isMobileDevice = \Zend_Http_UserAgent_Mobile::match($userAgent, $server);
        if (!$isMobileDevice) {
            return true;
        }
        return false;
    }

@indrisepos
Copy link

You can quickly fix it by commenting out Serialize in Device.php:
interface Zend_Http_UserAgent_Device //extends Serializable

or by adding the two Serialization methods in AbstractDevice.php:
indrisepos#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants