Skip to content

Deprecated Functionality: trim() #68

@gexxx05

Description

@gexxx05

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.

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