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

Fix deprecation warning on empty str_replace() parameter #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jhuhta
Copy link

@jhuhta jhuhta commented Sep 28, 2023

This fixes a deprecation error:

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/vendor/h5p/h5p-core/h5p.classes.php on line 1763

The error is given in Drupal on PHP 8.1 when saving a node with a H5P element.

@pjotrsavitski
Copy link

Thumbs up for the refactoring of str_replace functions enclosed into one another, although the code could be even more concise if you remove the empty check and just use the $value ?? '' instead. It will still be as readable and give the same result.

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

Successfully merging this pull request may close these issues.

2 participants