Magento2: Error in Magento_ConfigurableProduct upgrade step

Created on 13 Dec 2018  路  10Comments  路  Source: magento/magento2

Preconditions (*)

  1. Magento 2.2.2
  2. Latest stable PHP 7.2
  3. Latest stable composer
  4. Ubuntu 16.04

Steps to reproduce (*)

  1. Follow upgrade instructions on this page https://devdocs.magento.com/guides/v2.3/comp-mgr/cli/cli-upgrade.html

Expected result (*)

  1. Upgraded Magento version

Actual result (*)

  1. An exception when executing the php bin/magento setup:upgrade step

Here is the exception thrown:

Module 'Magento_ConfigurableProduct':
PHP Fatal error:  Uncaught TypeError: explode() expects parameter 2 to be string, boolean given in /var/www/devsite/vendor/magento/module-configurable-product/Setup/Patch/Data/UpdateManufacturerAttribute.php:55
Stack trace:
#0 /var/www/devsite/vendor/magento/module-configurable-product/Setup/Patch/Data/UpdateManufacturerAttribute.php(55): explode(',', false)
#1 /var/www/devsite/vendor/magento/framework/Setup/Patch/PatchApplier.php(162): Magento\ConfigurableProduct\Setup\Patch\Data\UpdateManufacturerAttribute->apply()
#2 /var/www/devsite/setup/src/Magento/Setup/Model/Installer.php(1002): Magento\Framework\Setup\Patch\PatchApplier->applyDataPatch('Magento_Configu...')
#3 /var/www/devsite/setup/src/Magento/Setup/Model/Installer.php(874): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\DataSetup), 'data', Array)
#4 /var/www/devsite/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php(123): Magento\Setup\Model\Installer->installDataFixtures(Array)
#5 /var/www/devsite/vendor/symfony/console/Comman in /var/www/devsite/vendor/magento/module-configurable-product/Setup/Patch/Data/UpdateManufacturerAttribute.php on line 55

I am trying to upgrade a Magento 2.2.2 site to 2.3.

Format is valid feature request

Most helpful comment

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

All 10 comments

Hi @Yamaha32088. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [x] Summary of the issue
  • [x] Information on your environment
  • [x] Steps to reproduce
  • [x] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.

@Yamaha32088 do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [x] no

Hi @milindsingh. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

@Yamaha32088 Magento 2.3 is not compatible with PHP 7.3.
Kindly check the system requirements in devdocs.
https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html

@milindsingh That was a typo I meant to say PHP 7.2

@milindsingh @engcom-backlog-nazar please reopen this issue

@Yamaha32088 i'm will retest

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

I was trying to upgrade the Magento from 2.1 to 2.3, the @JoostWan solution solved the problem for me.

The manufacturer row was missing in eav_attribute in our installation so we did the following:

`
INSERT INTO 'eav_attribute' ('attribute_id', 'entity_type_id', 'attribute_code', 'attribute_model', 'backend_model', 'backend_type', 'backend_table', 'frontend_model', 'frontend_input', 'frontend_label', 'frontend_class', 'source_model', 'is_required', 'is_user_defined', 'default_value', 'is_unique', 'note') VALUES (NULL, '4', 'manufacturer', NULL, NULL, 'varchar', NULL, NULL, 'text', 'Manufacturer', 'validate-length maximum-length-255', NULL, '0', '0', NULL, '0', NULL);

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)
SELECT attribute_id , 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 FROM eav_attribute WHERE attribute_code = 'manufacturer' AND entity_type_id = 4
`

(based on https://magento.stackexchange.com/questions/242846/magento-2-2-6-attribute-with-id-manufacturer-does-not-exist?rq=1)

The same query as @wessel-techtribe-nl provided but with proper field/table escaping: ` instead of '

INSERT INTO `eav_attribute` (
    `attribute_id`, `entity_type_id`, `attribute_code`, `attribute_model`, 
    `backend_model`, `backend_type`, `backend_table`, `frontend_model`, 
    `frontend_input`, `frontend_label`, `frontend_class`, `source_model`, 
    `is_required`, `is_user_defined`, `default_value`, `is_unique`, `note`
) VALUES (
    NULL, '4', 'manufacturer', NULL, NULL, 'varchar', NULL, NULL, 'text', 
    'Manufacturer', 'validate-length maximum-length-255', 
    NULL, '0', '0', NULL, '0', NULL
);

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
)
SELECT 
    attribute_id , 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 
FROM eav_attribute 
WHERE attribute_code = 'manufacturer' AND entity_type_id = 4;
Was this page helpful?
0 / 5 - 0 ratings