Skip to content

NOT PHP 8.1 compatible: passing null to parameter (explode deprecation)  #13

@wssweb

Description

@wssweb

Preconditions (*)

  1. Magento 2.4.5-p4
  2. PHP 8.1^
  3. /mageplaza/module-same-order-number (any version)

Steps to reproduce (*)

  1. Have magento 2 running on PHP 8.1
  2. Installed module-same-order-number via composer
  3. try to invoice an order

Expected result (*)

  1. Order invoices successfully
  2. no system log errors

Actual result (*)

  1. Order fails to invoice
  2. syslog displays:
    main.CRITICAL: Exception: Deprecated Functionality: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /home/html/vendor/mageplaza/module-same-order-number/Helper/Data.php on line 45 in /home/html/vendor/magento/framework/App/ErrorHandler.php:62

Solution (*)

Modify /vendor/mageplaza/module-same-number/Helper/Data.php line 45

old:
$this->applyForOption = explode(',', $this->getConfigGeneral('apply', $storeId));

new:
$this->applyForOption = explode(',', (string)$this->getConfigGeneral('apply', $storeId));

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