0

I receive the warning after upgrading to PHP 7.2 while running magento still in 2.2. Warning: count(): Parameter must be an array or an object that implements Countable in /vendor/magento/module-catalog/Model/Product/Option/Type/Select.php on line 71

i tried changing count, but i am stuck.

   if (!$this->_isSingleSelection()) {
            $valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId())->load();
            if ($valuesCollection->count() != count($value)) {
                $this->setIsValid(false);
                throw new LocalizedException(__('Please specify product\'s required option(s).'));
            }
        }
        return $this;
    }

2 Answers 2

0

Magento 2.2 not working with php 7.2, you need to upgrade to Magento 2.3.4

or you can install 2 php versions and change php for magento.

for example for CentOS /RHEL configuration: https://rpms.remirepo.net/wizard/

0

Thank you for your answer. At the moment i only experience this problem, all others have been fixed.

This behaviour only occurs if i try to add a product with radiobutton additions instead of check boxes. As corona is hitting my business very hard and my hoster will disable php 7.1 at 1st of april i need to find a way around. updating my shop is to expensiv at the moment as i have a very custom checkout but still need to pay my employees..

I found out i only need to change the way how count() is used but this function is to difficult for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.