Skip to content

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

Closed
@dverkade

Description

@dverkade

Preconditions

  1. Any Magento version (tested on all significant releases, 2.1, 2.2, 2.3)
  2. Reproduced on 2.4-develop
  3. #magento2/27411 was closed while it's a verified and open bug. You can't do that. Opening this as a new issue.

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

Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ready for confirmationPriority: P3May be fixed according to the position in the backlog.Progress: doneSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.duplicate

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions