Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/wp-includes/class-wp-token-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,19 +579,16 @@ public function read_token( $text, $offset = 0, &$matched_token_byte_length = nu
* @return string|null Mapped value of lookup key if found, otherwise `null`.
*/
private function read_small_token( $text, $offset, &$matched_token_byte_length, $case_sensitivity = 'case-sensitive' ) {
$ignore_case = 'ascii-case-insensitive' === $case_sensitivity;
$small_length = strlen( $this->small_words );
$search_text = substr( $text, $offset, $this->key_length );
if ( $ignore_case ) {
$search_text = strtoupper( $search_text );
}
$ignore_case = 'ascii-case-insensitive' === $case_sensitivity;
$small_length = strlen( $this->small_words );
$search_text = substr( $text, $offset, $this->key_length );
$starting_char = $search_text[0];

$at = 0;
while ( $at < $small_length ) {
if (
$starting_char !== $this->small_words[ $at ] &&
( ! $ignore_case || strtoupper( $this->small_words[ $at ] ) !== $starting_char )
( ! $ignore_case || 0 !== strcasecmp( $this->small_words[ $at ], $starting_char ) )
) {
$at += $this->key_length + 1;
continue;
Expand All @@ -605,7 +602,7 @@ private function read_small_token( $text, $offset, &$matched_token_byte_length,

if (
$search_text[ $adjust ] !== $this->small_words[ $at + $adjust ] &&
( ! $ignore_case || strtoupper( $this->small_words[ $at + $adjust ] !== $search_text[ $adjust ] ) )
( ! $ignore_case || 0 !== strcasecmp( $this->small_words[ $at + $adjust ], $search_text[ $adjust ] ) )
) {
$at += $this->key_length + 1;
continue 2;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/html-api/class-wp-html-decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function attribute_starts_with( $haystack, $search_text, $case_sen

while ( $search_at < $search_length && $haystack_at < $haystack_end ) {
$chars_match = $loose_case
? strtolower( $haystack[ $haystack_at ] ) === strtolower( $search_text[ $search_at ] )
? 0 === strcasecmp( $haystack[ $haystack_at ], $search_text[ $search_at ] )
: $haystack[ $haystack_at ] === $search_text[ $search_at ];

$is_introducer = '&' === $haystack[ $haystack_at ];
Expand Down