Skip to content

Commit c0770fd

Browse files
author
Viktor Tymchynskyi
committed
MAGETWO-38417: Table Rates shipping method does not work
- Add type checking
1 parent 702a318 commit c0770fd

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

lib/internal/Magento/Framework/Filesystem/Driver/File.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,16 @@ public function fileWrite($resource, $data)
645645
public function filePutCsv($resource, array $data, $delimiter = ',', $enclosure = '"')
646646
{
647647
/**
648-
* Security enhancement for CSV data processing by Excel-like applications.
649-
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1054702
650-
*/
648+
* Security enhancement for CSV data processing by Excel-like applications.
649+
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1054702
650+
*
651+
* @var $value string|\Magento\Framework\Phrase
652+
*/
651653
foreach ($data as $key => $value) {
652-
/** @var $value string|\Magento\Framework\Phrase */
653-
$value = (string)$value;
654+
655+
if (!is_string($value)) {
656+
$value = (string)$value;
657+
}
654658
if (isset($value[0]) && $value[0] === '=') {
655659
$data[$key] = ' ' . $value;
656660
}

lib/internal/Magento/Framework/Filesystem/Io/File.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,13 @@ public function streamWriteCsv(array $row, $delimiter = ',', $enclosure = '"')
180180
/**
181181
* Security enhancement for CSV data processing by Excel-like applications.
182182
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1054702
183+
*
184+
* @var $value string|\Magento\Framework\Phrase
183185
*/
184186
foreach ($row as $key => $value) {
185-
/** @var $value string|\Magento\Framework\Phrase */
186-
$value = (string)$value;
187+
if (!is_string($value)) {
188+
$value = (string)$value;
189+
}
187190
if (isset($value[0]) && $value[0] === '=') {
188191
$row[$key] = ' ' . $value;
189192
}

0 commit comments

Comments
 (0)