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

Passing null parameter to str_replace() makes wordpress debug to give an error on PHP > 8.1 #26

Open
Webstijlen opened this issue Aug 9, 2024 · 0 comments

Comments

@Webstijlen
Copy link

Passing null parameter to str_replace() makes wordpress debug to give an error on PHP > 8.1

Error

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/wp-content/plugins/highlighting-code-block/class/loos_hcb.php on line 79

Environment
Using PHP 8.3

Fix

/highlighting-code-block/class/loos_hcb.php
Rule number 80

Situation Now

$content = str_replace( 'prism on-numbers', 'prism line-numbers', $content );

Proposal

$content = str_replace( 'prism on-numbers', 'prism line-numbers', $content ?? '');

References

https://magento.stackexchange.com/posts/369717/timeline

tested and error message is gone

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