qenta-cee / magento2-qcp

QENTA Checkout Page extension for Magento 2
GNU General Public License v2.0
12 stars 10 forks source link

Deprecated Functionality: trim() #68

Open gexxx05 opened 7 months ago

gexxx05 commented 7 months ago

Prerequisites

Versions

Magento 2 version: 2.4.6-p3 PHP version: 8.2

Issue

Problem description:

Exception: Deprecated Functionality: trim(): Passing null to parameter ($string) of type string is deprecated in /www/html/vendor/qenta/magento2-qcp/Model/AbstractPayment.php on line 576

If instructions are empty the function below pass null to trim, and this is not allowed anymore. Maybe there are some more trims where a null value can happend.

We should change this:

public function getInstructions()
{
    return trim($this->getConfigData('instructions'));
}

to:

public function getInstructions()
{
    return trim($this->getConfigData('instructions') ?? '');
}

Steps to reproduce:

Activate module and payment method, leave instruction field blank, go to cart. Check debug or system log, the error message should appeare.