EmicoEcommerce / Magento2Tweakwise

Magento 2 module for Tweakwise integration
Other
4 stars 16 forks source link

"Illegal offset type in isset or empty" TypeError after saving a Yes/No attribute #203

Closed aadmathijssen closed 3 months ago

aadmathijssen commented 4 months ago

Issue Brief

Upon saving a Yes/No attribute, the following TypeError occurs:

TypeError: Illegal offset type in isset or empty in /app/vendor/tweakwise/magento2-tweakwise/Model/Catalog/Layer/Url/Strategy/FilterSlugManager.php:115

Environment

Steps to reproduce

  1. Login to the Magento admin
  2. Go to "Stores" > "Attributes" > "Product"
  3. Click the "Add New Attribute" button.
  4. Enter some string in the "Default Label" input, choose "Yes/No" in the "Catalog Input Type for Store Owner" select, and click on "Save Attribute".

Screenshot 2024-07-10 at 15 01 55

Actual result

An error page is shown with the following contents:

TypeError: Illegal offset type in isset or empty in /app/vendor/tweakwise/magento2-tweakwise/Model/Catalog/Layer/Url/Strategy/FilterSlugManager.php:115
Stack trace:
#0 /app/vendor/tweakwise/magento2-tweakwise/Observer/CreateTweakwiseSlugsAfterSaveAttribute.php(31): Tweakwise\Magento2Tweakwise\Model\Catalog\Layer\Url\Strategy\FilterSlugManager->createFilterSlugByAttributeOptions(Array)
#1 /app/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): Tweakwise\Magento2Tweakwise\Observer\CreateTweakwiseSlugsAfterSaveAttribute->execute(Object(Magento\Framework\Event\Observer))
#2 /app/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Tweakwise\Magento2Tweakwise\Observer\CreateTweakwiseSlugsAfterSaveAttribute), Object(Magento\Framework\Event\Observer))
#3 /app/vendor/magento/module-staging/Model/Event/Manager.php(97): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#4 /app/generated/code/Magento/Staging/Model/Event/Manager/Proxy.php(95): Magento\Staging\Model\Event\Manager->dispatch('catalog_entity_...', Array)
#5 /app/vendor/magento/framework/Model/AbstractModel.php(837): Magento\Staging\Model\Event\Manager\Proxy->dispatch('catalog_entity_...', Array)
#6 /app/vendor/magento/module-eav/Model/Entity/Attribute.php(356): Magento\Framework\Model\AbstractModel->afterSave()
#7 /app/vendor/magento/module-catalog/Model/ResourceModel/Eav/Attribute.php(256): Magento\Eav\Model\Entity\Attribute->afterSave()
#8 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Model\ResourceModel\Eav\Attribute->afterSave()
#9 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->___callParent('afterSave', Array)
#10 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->Magento\Framework\Interception\{closure}()
#11 /app/generated/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute/Interceptor.php(32): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->___callPlugins('afterSave', Array, Array)
#12 /app/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(842): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->afterSave()
#13 /app/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(402): Magento\Framework\Model\ResourceModel\Db\AbstractDb->processAfterSaves(Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor))
#14 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor))
#15 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Model\ResourceModel\Attribute\Interceptor->___callParent('save', Array)
#16 /app/vendor/magento/module-catalog-search/Model/Attribute/SearchWeight.php(62): Magento\Catalog\Model\ResourceModel\Attribute\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor))
#17 /app/vendor/magento/framework/Interception/Interceptor.php(135): Magento\CatalogSearch\Model\Attribute\SearchWeight->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Attribute\Interceptor), Object(Closure), Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor))
#18 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Model\ResourceModel\Attribute\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor))
#19 /app/generated/code/Magento/Catalog/Model/ResourceModel/Attribute/Interceptor.php(32): Magento\Catalog\Model\ResourceModel\Attribute\Interceptor->___callPlugins('save', Array, Array)
#20 /app/vendor/magento/framework/Model/AbstractModel.php(663): Magento\Catalog\Model\ResourceModel\Attribute\Interceptor->save(Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor))
#21 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\Model\AbstractModel->save()
#22 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->___callParent('save', Array)
#23 /app/vendor/mirasvit/module-navigation/src/LayeredNavigation/Plugin/Backend/SaveAttributeConfigPlugin.php(150): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->Magento\Framework\Interception\{closure}()
#24 /app/vendor/magento/framework/Interception/Interceptor.php(135): Mirasvit\LayeredNavigation\Plugin\Backend\SaveAttributeConfigPlugin->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor), Object(Closure))
#25 /app/vendor/mirasvit/module-seo-filter/src/SeoFilter/Plugin/Backend/SaveRewriteOnAttributeSavePlugin.php(133): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->Magento\Framework\Interception\{closure}()
#26 /app/vendor/magento/framework/Interception/Interceptor.php(135): Mirasvit\SeoFilter\Plugin\Backend\SaveRewriteOnAttributeSavePlugin->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor), Object(Closure))
#27 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->Magento\Framework\Interception\{closure}()
#28 /app/generated/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute/Interceptor.php(50): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->___callPlugins('save', Array, NULL)
#29 /app/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute/Save.php(303): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->save()
#30 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save->execute()
#31 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->___callParent('execute', Array)
#32 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->Magento\Framework\Interception\{closure}()
#33 /app/generated/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/Interceptor.php(23): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->___callPlugins('execute', Array, Array)
#34 /app/vendor/magento/framework/App/Action/Action.php(111): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->execute()
#35 /app/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#36 /app/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute.php(78): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#37 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Controller\Adminhtml\Product\Attribute->dispatch(Object(Magento\Framework\App\Request\Http))
#38 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->___callParent('dispatch', Array)
#39 /app/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(145): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#40 /app/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#41 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#42 /app/generated/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save/Interceptor.php(32): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->___callPlugins('dispatch', Array, Array)
#43 /app/vendor/magento/framework/App/FrontController.php(245): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#44 /app/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse(Object(Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor), Object(Magento\Framework\App\Request\Http))
#45 /app/vendor/magento/framework/App/FrontController.php(146): Magento\Framework\App\FrontController->processRequest(Object(Magento\Framework\App\Request\Http), Object(Magento\Catalog\Controller\Adminhtml\Product\Attribute\Save\Interceptor))
#46 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#47 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#48 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#49 /app/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#50 /app/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#51 /app/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#52 /app/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#53 {main}
Fatal error: Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /app/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 4075 in /app/vendor/magento/framework/App/ErrorHandler.php:62
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(256, 'Some transactio...', '/app/vendor/mag...', 4075)
#1 /app/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(4075): trigger_error('Some transactio...', 256)
#2 [internal function]: Magento\Framework\DB\Adapter\Pdo\Mysql->__destruct()
#3 {main}
  thrown in /app/vendor/magento/framework/App/ErrorHandler.php on line 62

Expected result

The Product attributes grid showing a "You saved the product attribute." notification.