Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated Functionality: trim() #68

Open
gexxx05 opened this issue Jan 16, 2024 · 0 comments
Open

Deprecated Functionality: trim() #68

gexxx05 opened this issue Jan 16, 2024 · 0 comments

Comments

@gexxx05
Copy link

gexxx05 commented Jan 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant