Skip to content

Commit

Permalink
TRAC 53635 | PHP 8.1: convert_invalid_entities() - fix handling of null
Browse files Browse the repository at this point in the history
Fixes `strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated` notices on PHP 8.1.

Impact: 38 of the pre-existing tests are affected by this issue.
  • Loading branch information
jrfnl committed Aug 11, 2021
1 parent 263b46e commit 788c65d
Show file tree
Hide file tree
Showing 2 changed files with 486 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,10 @@ function convert_chars( $content, $deprecated = '' ) {
* @return string Converted string.
*/
function convert_invalid_entities( $content ) {
if ( ! is_string( $content ) || '' === $content ) {
return $content;
}

$wp_htmltranswinuni = array(
'€' => '€', // The Euro sign.
'' => '',
Expand Down
Loading

0 comments on commit 788c65d

Please sign in to comment.