mageplaza/magento-2-same-order-number

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

wssweb opened this issue · 0 comments

wssweb commented

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