Closed
Description
Preconditions (*)
- Any Magento version (tested on all significant releases, 2.1, 2.2, 2.3)
- Reproduced on 2.4-develop
Steps to reproduce (*)
- Add a product either through migration, a custom importer or directly in the database.
- Leave out the field SKU (in other words, leave it NULL).
- Go to the product edit page in the backoffice.
Expected result (*)
- Should not be possible to add the product OR should not throw an error in the backoffice.
Actual result (*)
- Product is added without issues.
- When attempting to edit the product in the backoffice the following error is thrown:
Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Catalog\Model\ProductRepository::prepareSku() must be of the type string, null given, called in /vendor/magento/module-catalog/Model/ProductRepository.php on line 790 and defined in /vendor/magento/module-catalog/Model/ProductRepository.php:800 Stack trace: #0 /vendor/magento/module-catalog/Model/ProductRepository.php(790): Magento\Catalog\Model\ProductRepository->prepareSku(NULL) #1 /vendor/magento/module-catalog/Model/ProductRepository.php(349): Magento\Catalog\Model\ProductRepository->saveProductInLocalCache(Object(Magento\Catalog\Model\Product\Interceptor), '3e07f167255019f...') #2 /vendor/magento/module-catalog/Model/ProductRepository.php(314): Magento\Catalog\Model\ProductRepository->cacheProduct('3e07f167255019f...', Object(Magento\Catalog\Model\Product in /vendor/magento/module-catalog/Model/ProductRepository.php on line 800
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done