data-migration-tool
data-migration-tool copied to clipboard
Deprecated Functionality: preg_replace()
Preconditions
- From Magento 1.9.0.1
- To Magento 2.4.4
- PHP 8.1
Steps to reproduce
- bin/magento migrate:data vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.0.1/config.xml.dist -a
Expected result
- Successful migration
Actual result
[2022-08-04T08:44:12.308463+00:00][INFO][mode: data][stage: data migration][step: Map Step]: started 0% [>---------------------------] Remaining Time: < 1 sec In ErrorHandler.php line 61:
Deprecated Functionality: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/vendor/magento/data-migration-tool/src/Migration/Handler/TruncateSuffix.
php on line 93
Additional notes
Hi @Andreabont. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Unbelievable that this is still an issue. You can apply this patch to fix it:
--- src/Migration/Handler/TruncateSuffix.php 2022-04-11 15:42:50.000000000 +0000
+++ src/Migration/Handler/TruncateSuffix.php 2022-11-21 16:30:02.926243596 +0000
@@ -90,7 +90,8 @@
if (in_array($recordToHandle->getValue('attribute_id'), $attributeIds)) {
$suffix = '~' . preg_quote($this->getSuffix()) . '$~';
$value = $recordToHandle->getValue($this->field);
- $value = preg_replace($suffix, '', $value);
+ if ($value !== null)
+ $value = preg_replace($suffix, '', $value);
$recordToHandle->setValue($this->field, $value);
}
}
mlaurense, Already tried to apply your patch, but its the same issue for 2.4.5 version. Any thoughts? This is not yet fixed...
Thank you
@VrumVrum You mean it is STILL not fixed...
it appears the file is the same in 2.4.5 tag, so you should be able to apply the patch successfully. Check if your vendor/magento/data-migration-tool/src/Migration/Handler/TruncateSuffix.php is changed; line 93 should contain the if ($value !== null)