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

[functions_permalinks.inc.php] str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated #867

Open
bauigel opened this issue Jan 25, 2025 · 1 comment

Comments

@bauigel
Copy link

bauigel commented Jan 25, 2025

Another PHP 8.1 noice...

170         // Replace some emojis and flags into latin characters before mb_convert_encoding() strips them away
171         $str = str_replace($pre_from, $pre_to, $str);                   

Maybe an if would be enough here.

170         // Replace some emojis and flags into latin characters before mb_convert_encoding() strips them away
171         if (is_null($str)) {                                                                                                                                       
172             $str = '';
173         }
174         $str = str_replace($pre_from, $pre_to, $str);    
@garvinhicking
Copy link
Member

$str = str_replace($pre_from, $pre_to, $str ?? '');  

is a more common approach that at least I see in PHP projects, this might do the trick too?

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

2 participants