Skip to content

Commit 148cd11

Browse files
committed
ACP2E-1531: Data Migration Tool 2.4.5 with PHP 8.1 compatibility issues
1 parent ab64f46 commit 148cd11

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Migration Tool",
44
"version": "2.4.5",
55
"require": {
6-
"symfony/console": "~4.4.0",
6+
"symfony/console": "^5.4",
77
"magento/framework": "*",
88
"monolog/monolog": "^2.3"
99
},

src/Migration/Handler/SetValue.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,20 @@ public function handle(Record $recordToHandle, Record $oppositeRecord)
3232
{
3333
$this->validate($recordToHandle);
3434
$valueStored = $recordToHandle->getValue($this->field);
35-
$operator = substr($this->value, 0, 1);
36-
$value = substr($this->value, 1);
37-
switch ($operator) {
38-
case '+':
39-
$value = $valueStored + $value;
40-
break;
41-
case '-';
42-
$value = $valueStored - $value;
43-
break;
44-
default:
45-
$value = $this->value;
35+
$value = $this->value;
36+
if (is_string($value)) {
37+
$operator = substr($value, 0, 1);
38+
$value = substr($value, 1);
39+
switch ($operator) {
40+
case '+':
41+
$value = $valueStored + $value;
42+
break;
43+
case '-';
44+
$value = $valueStored - $value;
45+
break;
46+
default:
47+
$value = $this->value;
48+
}
4649
}
4750
$recordToHandle->setValue($this->field, $value);
4851
}

0 commit comments

Comments
 (0)