Skip to content
New issue

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

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

Already on GitHub? # to your account

[Bug]: On PHP8, deprecation warning occurs when trim() function is called with a null parameter #542

Open
lasso opened this issue Nov 14, 2024 · 1 comment

Comments

@lasso
Copy link

lasso commented Nov 14, 2024

Expected behavior

trim() function should not be called with null parameter.

Actual behavior

In src/DuplicatesIndex/DefaultMariaDbDuplicatesIndex.php, line 699 the trim() function gets called without ensuring that the value is not null. Before PHP8 this was not a problem, put in PHP8 this raises a deprecation warning:

<b>Deprecated</b>: trim(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/var/www/pimcore/vendor/pimcore/customer-management-framework-bundle/src/Dupl
icatesIndex/DefaultMariaDbDuplicatesIndex.php</b> on line <b>699</b><br />

If error_reporting is set to E_ALL, this will mess up the response sent to the client.

Steps to reproduce

Sorry, even though I was a PHP developer a long time ago, I'm not a regular Pimcore developer/user. While helping a customer, I found this error tainting a JSON response and decided to find out where it came from. I guess a prerequisite would be that at least one of the fields in the index must be null, but beyond that I don't have any more information.

@lasso lasso added the Bug label Nov 14, 2024
Copy link

github-actions bot commented Dec 5, 2024

Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant