cancel
Showing results for 
Search instead for 
Did you mean: 

2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

SOLVED

2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

I get this error after upgrading to 2.3.0 from 2.2.5 and running

php bin/magento setup:upgrade

Any idea?

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

Accepted Solutions

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

Run following SQL query in DB :

 

** attribute_id** = first check number of entries in catalog_eav_attribute table, according to last entery ,increment that id from 1(One) and use as attribute_id in below query.

Means, If in catalog_eav_attribute table last entry is 213 then use 214 as new attribute_id for below SQL query.

 

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 (** attribute_id**, '4', 'manufacturer', NULL, NULL, 'varchar', NULL, NULL, 'text', 'Manufacturer', 'validate-length maximum-length-255', NULL, '0', '0', NULL, '0', NULL);

 

Then run below SQL query in DB-

 

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 (** 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);

View solution in original post

9 REPLIES 9

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

Run following SQL query in DB :

 

** attribute_id** = first check number of entries in catalog_eav_attribute table, according to last entery ,increment that id from 1(One) and use as attribute_id in below query.

Means, If in catalog_eav_attribute table last entry is 213 then use 214 as new attribute_id for below SQL query.

 

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 (** attribute_id**, '4', 'manufacturer', NULL, NULL, 'varchar', NULL, NULL, 'text', 'Manufacturer', 'validate-length maximum-length-255', NULL, '0', '0', NULL, '0', NULL);

 

Then run below SQL query in DB-

 

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 (** 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);

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

Thanks!

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

More precisely, you have to get something within the apply_to field

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:


@eddy_mio wrote:

More precisely, you have to get something within the apply_to field


makes a lot more sense and did the trick. Thanks!

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

I'd also like to indicate, this fix also allows the attribute to appear in the admin panel again, this is a bug of the migration tool and many attributes end up with this missing such as inventory, manu. and many more. Install a stock Magento install on 2.3, review these tables, and check this for all stock attributes. 

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

For me the first insert failed with ERROR 1062 (23000): Duplicate entry:

MariaDB [magento]> 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 (255, 4, 'manufacturer', NULL, NULL, 'varchar', NULL, NULL, 'text', 'Manufacturer', 'validate-length maximum-length-255', NULL, 0, 0, NULL, 0, NULL);
ERROR 1062 (23000): Duplicate entry '4-manufacturer' for key 'EAV_ATTRIBUTE_ENTITY_TYPE_ID_ATTRIBUTE_CODE'

Finding the attribute_id for the entry that caused the error

MariaDB [magento]> select attribute_id from eav_attribute where entity_type_id = 4 and attribute_code ='manufacturer';
+--------------+
| attribute_id |
+--------------+
|           81 |
+--------------+
1 row in set (0.00 sec)

And using this attribute_id (81 in my case) to update catalog_eav_attribute

MariaDB [magento]> update catalog_eav_attribute set apply_to = 'simple, virtual, bundle, downloadable, configurable' where attribute_id = 81;
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

made magento setup:upgrade work again.

 

Thank you for your help Smiley Happy

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

Just want to say Thanks! The solution works for us. 

 

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

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

Re: 2.2.5 to 2.3.0 Fatal error: Uncaught TypeError:

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.