Skip to content

Commit 04037a5

Browse files
author
Leonid Poluyanov
committed
MAGETWO-45047: Data modification in Export result file
1 parent f291b99 commit 04037a5

File tree

1 file changed

+13
-0
lines changed
  • lib/internal/Magento/Framework/Convert

1 file changed

+13
-0
lines changed

lib/internal/Magento/Framework/Convert/Excel.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ protected function _getXmlRow($row, $useCallback)
134134
$value = htmlspecialchars($value);
135135
$dataType = is_numeric($value) && $value[0] !== '+' && $value[0] !== '0' ? 'Number' : 'String';
136136

137+
/**
138+
* Security enhancement for CSV data processing by Excel-like applications.
139+
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1054702
140+
*
141+
* @var $value string|\Magento\Framework\Phrase
142+
*/
143+
if (!is_string($value)) {
144+
$value = (string)$value;
145+
}
146+
if (isset($value[0]) && in_array($value[0], ['=', '+', '-'])) {
147+
$value = ' ' . $value;
148+
}
149+
137150
$value = str_replace("\r\n", '
', $value);
138151
$value = str_replace("\r", '
', $value);
139152
$value = str_replace("\n", '
', $value);

0 commit comments

Comments
 (0)