magento2: Undefined offset error when upgrading CE 2.1.6 to CE 2.2.0
I was upgrading my magento from CE 2.1.6 to CE 2.2.0:
- Navigate to my magento folder
- Execute
composer require magento/product-community-edition 2.2.0 --no-update
composer update
- Then
php bin/magento setup:upgrade
I saw:
Notice: Undefined offset: 1 in /var/www/html/vendor/magento/module-theme/Model/ResourceModel/Theme/Collection.php on line 137
Can any help? Thanks.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 24 (3 by maintainers)
I believe I have a solution for this. When I looked in core_config_data I found that the theme_id stored for scope_id 0 was set to “NULL”. This appears to be how it was stored in previous versions. I looked at the theme table and got the ID of my adminhtml theme and set that in core_config_data for scope_id 0. Now I can run setup:upgrade again.
Okay sorry for my bad explanation, I hope this helps otherwise I should improve my English writing skills 💯.
I added these lines to the table core_config_data because I have had a look on another magento2 instance of mine which is on Version 2.2.0, I saw that the theme_id of the default scope was the same id I have on the store scope. After this change another error popped up with the “design/theme/ua_regexp” which was not a valid JSON object before it was a:0:{} so I changed it to {}, because Magento was expecting an empty JSON object. For me, it was the easiest way to add these lines and to clear the cache afterward.
Have had the same issue removed it by:
Hope this helps someone 😄
Can confirm after upgrade from CE 2.1.9 to 2.2.0