magento2: Custom import failing when SKU contains double-quote character

Preconditions and environment

CE 2.4.6-p3 PHP 8.1

Steps to reproduce

This occurs with a custom import module hence not reproducible elsewhere. However, issue is in how the core functions; details below. The issue occurs when an SKU includes a double-quote character e.g. NSP105IST-39.5". For reasons beyond our control, some SKU include this.

Expected result

Custom import works

Actual result

Custom import fails

Additional information

Issue is in the following code.

vendor/magento/zend-db/library/Zend/Db/Statement.php

image

When the SKU contains " character, this results in $sql = null. PHP 8.x no longer allows null to be passed to prereg_replace (daft change!) hence next filter crashes:

image

Fix (commented in the first image) is to check for null before continuing, as now required by PHP8.

Release note

Fix import issue where SKU contains double-quote character.

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 1
  • Comments: 18 (2 by maintainers)

Most upvoted comments

I have already included the sql that was causing the error. This was extracted from a live debug session having broken on an unhandled exception. Let me reproduce it and present a debugger screenshot showing the input and exception. I will come back to you.