Skip to content

Commit 5637c2e

Browse files
committed
TRAC 53635 | PHP 8.1: convert_invalid_entities() - fix handling of null
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.
1 parent 2f2d321 commit 5637c2e

File tree

2 files changed

+486
-0
lines changed

2 files changed

+486
-0
lines changed

src/wp-includes/formatting.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,10 @@ function convert_chars( $content, $deprecated = '' ) {
23962396
* @return string Converted string.
23972397
*/
23982398
function convert_invalid_entities( $content ) {
2399+
if ( ! is_string( $content ) || '' === $content ) {
2400+
return $content;
2401+
}
2402+
23992403
$wp_htmltranswinuni = array(
24002404
'€' => '€', // The Euro sign.
24012405
'' => '',

0 commit comments

Comments
 (0)