Skip to content

Commit c891fac

Browse files
authored
PHP 8.1: replaced deprecated gmstrftime() with gmdate() (#2951)
1 parent 7302b5e commit c891fac

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ protected function _saveCustomers()
364364
{
365365
/** @var Mage_Customer_Model_Customer $resource */
366366
$resource = Mage::getModel('customer/customer');
367-
$strftimeFormat = Varien_Date::convertZendToStrftime(Varien_Date::DATETIME_INTERNAL_FORMAT, true, true);
368367
$table = $resource->getResource()->getEntityTable();
369368
/** @var Mage_ImportExport_Model_Resource_Helper_Mysql4 $helper */
370369
$helper = Mage::getResourceHelper('importexport');
@@ -392,7 +391,7 @@ protected function _saveCustomers()
392391
'store_id' => empty($rowData[self::COL_STORE])
393392
? 0 : $this->_storeCodeToId[$rowData[self::COL_STORE]],
394393
'created_at' => empty($rowData['created_at'])
395-
? $now : gmstrftime($strftimeFormat, strtotime($rowData['created_at'])),
394+
? $now : gmdate(Varien_Date::DATETIME_PHP_FORMAT, strtotime($rowData['created_at'])),
396395
'updated_at' => $now
397396
];
398397

@@ -424,7 +423,7 @@ protected function _saveCustomers()
424423
if ($attrParams['type'] === 'select') {
425424
$value = $attrParams['options'][strtolower($value)];
426425
} elseif ($attrParams['type'] === 'datetime') {
427-
$value = gmstrftime($strftimeFormat, strtotime($value));
426+
$value = gmdate(Varien_Date::DATETIME_PHP_FORMAT, strtotime($value));
428427
} elseif ($attrParams['type'] === 'multiselect') {
429428
$value = (array)$attrParams['options'][strtolower($value)];
430429
$attribute->getBackend()->beforeSave($resource->setData($attrCode, $value));

app/code/core/Mage/ImportExport/Model/Import/Entity/Customer/Address.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ protected function _importData()
156156
$customer = Mage::getModel('customer/customer');
157157
/** @var Mage_Customer_Model_Address $resource */
158158
$resource = Mage::getModel('customer/address');
159-
$strftimeFormat = Varien_Date::convertZendToStrftime(Varien_Date::DATETIME_INTERNAL_FORMAT, true, true);
160159
$table = $resource->getResource()->getEntityTable();
161160
/** @var Mage_ImportExport_Model_Resource_Helper_Mysql4 $helper */
162161
$helper = Mage::getResourceHelper('importexport');
@@ -201,7 +200,7 @@ protected function _importData()
201200
if ($attrParams['type'] === 'select') {
202201
$value = $attrParams['options'][strtolower($rowData[$attrAlias])];
203202
} elseif ($attrParams['type'] === 'datetime') {
204-
$value = gmstrftime($strftimeFormat, strtotime($rowData[$attrAlias]));
203+
$value = gmdate(Varien_Date::DATETIME_PHP_FORMAT, strtotime($rowData[$attrAlias]));
205204
} elseif ($attrParams['type'] === 'multiselect') {
206205
$value = $attrParams['options'][strtolower($rowData[$attrAlias])];
207206
$multiSelect[$attrParams['id']][] = $value;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,7 @@ protected function _saveProducts()
15161516
/**
15171517
* Retrieve pattern for time formatting
15181518
*
1519+
* @deprecated
15191520
* @return string
15201521
*/
15211522
protected function _getStrftimeFormat()
@@ -1569,7 +1570,7 @@ protected function _prepareAttributes($rowData, $rowScope, $attributes, $rowSku,
15691570
$storeIds = [0];
15701571

15711572
if ($attribute->getBackendType() === 'datetime' && strtotime($attrValue)) {
1572-
$attrValue = gmstrftime($this->_getStrftimeFormat(), strtotime($attrValue));
1573+
$attrValue = gmdate(Varien_Date::DATETIME_PHP_FORMAT, strtotime($attrValue));
15731574
} elseif ($attribute->getAttributeCode() === 'url_key') {
15741575
if (empty($attrValue)) {
15751576
$attrValue = $product->formatUrlKey($product->getName());

0 commit comments

Comments
 (0)