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(): #924

Open
ioweb-gr opened this issue Jun 13, 2024 · 1 comment
Open

Deprecated Functionality: preg_replace(): #924

ioweb-gr opened this issue Jun 13, 2024 · 1 comment

Comments

@ioweb-gr
Copy link

ioweb-gr commented Jun 13, 2024

Preconditions

  1. 1.9.4.5
  2. 2.4.7

Steps to reproduce

  1. Run the data migration step
  2. See the error
 Deprecated Functionality: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /httpdocs/vendor/magento/data-migration-tool/src/Migration/Handler/TruncateSuffix.ph
  p on line 93

This is a php version incompatibility that needs to be fixed

Expected result

  1. No warning is thrown

Actual result

  1. Warning is thrown

Additional notes

image

Fixed with

Index: vendor/magento/data-migration-tool/src/Migration/Handler/TruncateSuffix.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vendor/magento/data-migration-tool/src/Migration/Handler/TruncateSuffix.php b/vendor/magento/data-migration-tool/src/Migration/Handler/TruncateSuffix.php
--- a/vendor/magento/data-migration-tool/src/Migration/Handler/TruncateSuffix.php	
+++ b/vendor/magento/data-migration-tool/src/Migration/Handler/TruncateSuffix.php	(date 1718293775929)
@@ -90,7 +90,7 @@
         if (in_array($recordToHandle->getValue('attribute_id'), $attributeIds)) {
             $suffix = '~' . preg_quote($this->getSuffix()) . '$~';
             $value = $recordToHandle->getValue($this->field);
-            $value = preg_replace($suffix, '', $value);
+            $value = preg_replace($suffix, '', (string)$value);
             $recordToHandle->setValue($this->field, $value);
         }
     }

Copy link

m2-assistant bot commented Jun 13, 2024

Hi @ioweb-gr. 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.

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

1 participant