OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
865 stars 435 forks source link

Error when saving product with image without description #4134

Closed MateusM3 closed 1 week ago

MateusM3 commented 1 month ago

The problem continues to occur, i noticed that it was fixed in the issue #4023 but, in the current version 20.10.2 it continues to happen

*Preconditions ()** OpenMage 20.10.2 PHP 8.2

*Steps to reproduce ()** Open the Catalog -> Create Product -> Upload Images -> with out description (label) -> Save

*Expected result ()** Saving the product with an empty label like previous versions, may be the version of PHP that is more careful regarding the array key not existing

*### Actual result ()**

image

empiricompany commented 1 month ago

i cannot reproduce this issues

result

i've also tried with a new fresh product result2

on latest OpenMage 10.10.2 / php 8.2

devmode is enabled and error level is setted to debug devmode

devmode

devmode2

empiricompany commented 1 month ago

Here you said the patch had fixed the problem https://github.com/OpenMage/magento-lts/issues/4023#issuecomment-2150111650

Mage_Catalog_Model_Product_Attribute_Backend_Media contains the patch? https://github.com/OpenMage/magento-lts/pull/4024/files

i see in your composer update you have a package named k13/overwrite_customer_module_openmage maybe this rewrite the class?

MateusM3 commented 1 month ago

It's not working here, about the module this module is private to another function, I'm debugging here and it enters the normal core class

One thing I noticed that you're doing differently is not selecting the "base image", "small image" and "thumb"

empiricompany commented 1 month ago

It's not working here, about the module this module is private to another function, I'm debugging here and it enters the normal core class

One thing I noticed that you're doing differently is not selecting the "base image", "small image" and "thumb"

I think I also tried selecting the image as you say, but I'll try tomorrow better by making sure I do it

Have you checked if the class is updated correctly with the patch?

sreichel commented 1 month ago

Looks like 3rd-party code. Please share a stacktrace ...

empiricompany commented 1 month ago

Bug confirmed, steps to reproduce:

  1. Create a new product
  2. Add a new media image and mark it as the default image for Base Image, Small Image, and Thumbnail
  3. Save

Result: Upon save, this error occurs (and the product is not saved):

2024-08-01T06:38:15+00:00 ERR (3):
Mage_Eav_Model_Entity_Attribute_Exception: Warning: Undefined array key "label_use_default"  in /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php on line 170 in /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Core/Model/Config.php:1478
Stack trace:
#0 /shared/httpd/github-openmage/htdocs/app/Mage.php(542): Mage_Core_Model_Config->getModelInstance('eav/entity_attr...', 'Warning: Undefi...')
#1 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Eav/Model/Entity/Abstract.php(644): Mage::getModel('eav/entity_attr...', 'Warning: Undefi...')
#2 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1628): Mage_Eav_Model_Entity_Abstract->walkAttributes('backend/beforeS...', Array)
#3 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Catalog/Model/Resource/Product.php(167): Mage_Eav_Model_Entity_Abstract->_beforeSave(Object(Mage_Catalog_Model_Product))
#4 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1090): Mage_Catalog_Model_Resource_Product->_beforeSave(Object(Mage_Catalog_Model_Product))
#5 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Core/Model/Abstract.php(379): Mage_Eav_Model_Entity_Abstract->save(Object(Mage_Catalog_Model_Product))
#6 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(748): Mage_Core_Model_Abstract->save()
#7 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(424): Mage_Adminhtml_Catalog_ProductController->saveAction()
#8 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch('save')
#9 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#10 /shared/httpd/github-openmage/htdocs/app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch()
#11 /shared/httpd/github-openmage/htdocs/app/Mage.php(758): Mage_Core_Model_App->run(Array)
#12 /shared/httpd/github-openmage/htdocs/index.php(60): Mage::run('', 'store')
#13 {main}

screen

empiricompany commented 3 weeks ago

@MateusM3 please review the patch in this PR https://github.com/OpenMage/magento-lts/pull/4136 if works for you