Magento Upgrade Error from 2.2.3 to 2.3 in Module Configurable Product

databasemagento2magento2.2.3magento2.3setup-upgrade

Upgrading M2 from 2.2.3 to 2.3 gives me the following error during the magento setup:upgrade process:

PHP Fatal error:  Uncaught TypeError: explode() expects parameter 2 to be string, boolean given in /vendor/magento/module-configurable-product/Setup/Patch/Data/UpdateManufacturerAttribute.php:55

/vendor/magento/module-eav/Setup/EavSetup.php::getAttribute can return false – which it does in my case:

$eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'manufacturer', 'apply_to') returns bool(false)

See vendor/magento/module-eav/Setup/EavSetup.php line 1163:

        if ($field !== null) {
            return isset($row[$field]) ? $row[$field] : false;
        }

The update script vendor/magento/module-configurable-product/Setup/Patch/Data/UpdateManufacturerAttribute.php in Line 55 does not check for booleans.

        $relatedProductTypes = explode(
            ',',
            $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'manufacturer', 'apply_to')
        );

How do I fix this error?

Simply skipping this by exiting if the value is false gives me another error:

PHP Fatal error:  Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3955 ...

Best Answer

As mentionned in this issue on the M2 github

Search in the database in table eav_attribute for attribute manufacturer and copy the ID. With this id search in catalog_eav_attribute. Now enter the following in column apply_to

simple, virtual, bundle, downloadable, configurable

Now setup:upgrade is working.

Related Topic