Skip to content

Commit 52cd8ad

Browse files
Merge commit from fork
* Implement null byte character removal for name field * Move null byte sanitization to _filterRowData method. --------- Co-authored-by: Colin Mollenhour <colin@mollenhour.com>
1 parent 2c80954 commit 52cd8ad

File tree

1 file changed

+15
-0
lines changed
  • app/code/core/Mage/ImportExport/Model/Import/Entity

1 file changed

+15
-0
lines changed

app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
2727
*/
2828
public const CONFIG_KEY_PRODUCT_TYPES = 'global/importexport/import_product_types';
2929

30+
/**
31+
* Allowed column name format
32+
*/
33+
private const COL_NAME_FORMAT = '/[\x00-\x1F\x7F]/';
34+
3035
/**
3136
* Size of bunch - part of products to save in one step.
3237
*/
@@ -90,6 +95,12 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
9095
*/
9196
public const COL_SKU = 'sku';
9297

98+
/**
99+
* Col Name
100+
*/
101+
102+
public const COL_NAME = 'name';
103+
93104
/**
94105
* Error codes.
95106
*/
@@ -1973,6 +1984,10 @@ protected function _filterRowData(&$rowData)
19731984
if (!isset($rowData[self::COL_SKU])) {
19741985
$rowData[self::COL_SKU] = null;
19751986
}
1987+
// Remove null byte character
1988+
if (!empty($rowData[self::COL_NAME])) {
1989+
$rowData[self::COL_NAME] = preg_replace(self::COL_NAME_FORMAT, '', $rowData[self::COL_NAME]);
1990+
}
19761991
}
19771992

19781993
/**

0 commit comments

Comments
 (0)