3

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 ...
7

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.

2
  • Thanks for the fast response. I didn't see that issue. It fixed it. – tecjam Jan 16 '19 at 15:03
  • Thanks!! it helped me. – Rohit Chauhan Apr 26 at 18:26
1

We also encountered this problem when we upgraded from 2.2.5 to 2.3. The problem we had was the manufacturer eav_attribute did not exist at all. We followed this Magento Github Issue #19739 and inserted an eav_attribute record with the following SQL:

INSERT INTO eav_attribute (entity_type_id, attribute_code, backend_type, frontend_input, frontend_label, frontend_class, is_required, is_user_defined, is_unique) VALUES ((SELECT entity_type_id from eav_entity_type where entity_type_code='catalog_product'), 'manufacturer', 'varchar', 'text', 'Manufacturer', 'validate-length maximum-length-255', 0, 0, 0);

After confirming the manufacturer record is in place, insert a record in the catalog_eav_attribute table using the following SQL:

INSERT INTO catalog_eav_attribute (attribute_id, is_global, is_visible, is_searchable, is_filterable, is_comparable, is_visible_on_front, is_html_allowed_on_front, is_used_for_price_rules, is_filterable_in_search, used_in_product_listing, used_for_sort_by, apply_to, is_visible_in_advanced_search, position, is_wysiwyg_enabled, is_used_for_promo_rules, is_required_in_admin_store, is_used_in_grid, is_visible_in_grid, is_filterable_in_grid, search_weight, additional_data) VALUES ((SELECT attribute_id from eav_attribute where attribute_code='manufacturer'), 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, "simple, virtual, bundle, downloadable, configurable", 1, 0, 0, 0, 0, 0, 0, 0, 1, NULL);

We also got caught with some modules had their schema updated and not data as the setup:upgrade aborted midway through. We had to manually update the schema version aligned with the data version in setup_module table to ensure a clean redeploy.

Interesting note, in our development instances where the sample data are part of the required composer package, the manufacturer eav attribute exist and it's an int type with a select frontend input.

Hope that helps someone out there.

0

Precisely, to fix the error

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

You can simply execute the below SQL:

UPDATE catalog_eav_attribute SET apply_to = 'simple,configurable,virtual,bundle,downloadable' WHERE attribute_id = (
    SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'manufacturer' AND entity_type_id = 4
)

Note: apply_to attribute can be guessed from the exception trace during setup:upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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