Skip to content

Commit f408760

Browse files
HTML API: Use str_contains() instead of strpos() in WP_HTML_Tag_Processor.
The `str_contains()` function was introduced in PHP 8.0 and a polyfill is available in WordPress Core, making the intent of the check clearer than comparing the result of `strpos()` against false. Follow-up to [62687]. Props Soean, mukesh27, westonruter. See #64897. git-svn-id: https://develop.svn.wordpress.org/trunk@62964 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1606cb0 commit f408760

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/wp-includes/html-api/class-wp-html-tag-processor.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ private function parse_next_tag(): bool {
20732073
*/
20742074
$is_valid_pi = (
20752075
0 !== $target_length &&
2076-
false !== strpos( " \t\f\r\n?>", $html[ $target_at + $target_length ] ) &&
2076+
str_contains( " \t\f\r\n?>", $html[ $target_at + $target_length ] ) &&
20772077
! ( 3 === $target_length && 0 === substr_compare( $html, 'xml', $target_at, 3, true ) ) &&
20782078
! ( 14 === $target_length && 0 === substr_compare( $html, 'xml-stylesheet', $target_at, 14, true ) )
20792079
);

0 commit comments

Comments
 (0)