Skip to content

Table structure issue catalog_product_entity (sku field is allowed nulls) #27411

Closed
@stephan-cream

Description

@stephan-cream

Preconditions (*)

  1. Any Magento version (tested on all significant releases, 2.1, 2.2, 2.3)
  2. Reproduced on 2.4-develop

Steps to reproduce (*)

  1. Add a product either through migration, a custom importer or directly in the database.
  2. Leave out the field SKU (in other words, leave it NULL).
  3. Go to the product edit page in the backoffice.

Expected result (*)

  1. Should not be possible to add the product OR should not throw an error in the backoffice.

Actual result (*)

  1. Product is added without issues.
  2. 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

Component: DataFixed in 2.4.xThe issue has been fixed in 2.4-develop branchPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.1.xIndicates original Magento version for the Issue report.Severity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions