Product import: Remove line breaks in keys (#35880)
* Product import: Remove line breaks in keys Remove line breaks in keys, to avoid mismatch mapping of keys. * Fix syntax * PHPCS * Changelog. Co-authored-by: barryhughes <3594411+barryhughes@users.noreply.github.com>
This commit is contained in:
parent
6fe4afad14
commit
f4032654a3
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
When importing product CSV, ensure line breaks within header columns do not break the import process.
|
|
@ -79,6 +79,9 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
if ( false !== $handle ) {
|
||||
$this->raw_keys = version_compare( PHP_VERSION, '5.3', '>=' ) ? array_map( 'trim', fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'], $this->params['escape'] ) ) : array_map( 'trim', fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'] ) ); // @codingStandardsIgnoreLine
|
||||
|
||||
// Remove line breaks in keys, to avoid mismatch mapping of keys.
|
||||
$this->raw_keys = wc_clean( wp_unslash( $this->raw_keys ) );
|
||||
|
||||
// Remove BOM signature from the first item.
|
||||
if ( isset( $this->raw_keys[0] ) ) {
|
||||
$this->raw_keys[0] = $this->remove_utf8_bom( $this->raw_keys[0] );
|
||||
|
|
Loading…
Reference in New Issue