Skip to content

Deprecated Functionality: preg_replace(): #924

@ioweb-gr

Description

@ioweb-gr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions