Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated Functionality: preg_replace() #899

Open
Andreabont opened this issue Aug 4, 2022 · 5 comments
Open

Deprecated Functionality: preg_replace() #899

Andreabont opened this issue Aug 4, 2022 · 5 comments

Comments

@Andreabont
Copy link

Preconditions

  1. From Magento 1.9.0.1
  2. To Magento 2.4.4
  3. PHP 8.1

Steps to reproduce

  1. bin/magento migrate:data vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.0.1/config.xml.dist -a

Expected result

  1. 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

@m2-assistant
Copy link

m2-assistant bot commented Aug 4, 2022

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


@mlaurense
Copy link

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);
         }
     }

@VrumVrum
Copy link

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

@mlaurense
Copy link

@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)

@fabrice-dresscodes
Copy link

Still not fixed.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants