phpmagento2.4zend-filterphp-8.2

I'm getting this error: Class "Zend_Filter_LocalizedToNormalized" not found


Not sure if it has to do with php 8.2 specifically or just php 8. My exception log is saying that it's not found here in this file but below is the code from line(s) 190 - 197. Checkout/Controller/Cart/Add.php:191

    if (isset($params['qty'])) {
        $filter = new \Zend_Filter_LocalizedToNormalized(
            ['locale' => $this->_objectManager->get(
                \Magento\Framework\Locale\ResolverInterface::class
            )->getLocale()]
        );
        $params['qty'] = $filter->filter($params['qty']);
    }

It was working in php 7.3 and so i honestly am not sure what it wants me to do here. Any help would be greatly appreciated. Thank you.


Solution

  • This was what ended up working for me:

    use Magento\Framework\Filter\LocalizedToNormalized;
    use Magento\Framework\Locale\ResolverInterface;
    
    
                if (isset($params['qty'])) {
                $filter = new LocalizedToNormalized(
                    ['locale' => $this->_objectManager->get(
                        ResolverInterface::class
                    )->getLocale()]
                );
                $params['qty'] = $filter->filter($params['qty']);
            }