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
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-admin-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ final protected function _render_item( $node ) {
}
}

echo ">{$arrow}{$node->title}";
echo '>' . $arrow . wp_kses_normalize_entities( $node->title );

if ( $has_link ) {
echo '</a>';
Expand Down
19 changes: 19 additions & 0 deletions tests/phpunit/tests/adminbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,25 @@ public function test_admin_bar_with_tabindex_meta( $node_data, $expected_html )
$this->assertStringContainsString( $expected_html, $admin_bar_html );
}

/**
* @ticket 62545
*/
public function test_admin_bar_normalizes_title_entities_without_escaping_html() {
$admin_bar = new WP_Admin_Bar();
$admin_bar->add_node(
array(
'id' => 'test-node',
'title' => '<span class="ab-icon" aria-hidden="true"></span>This & that',
'href' => 'https://example.org',
)
);

$admin_bar_html = get_echo( array( $admin_bar, 'render' ) );

$this->assertStringContainsString( '<span class="ab-icon" aria-hidden="true"></span>This &amp; that', $admin_bar_html );
$this->assertStringNotContainsString( '&lt;span class=&quot;ab-icon&quot;', $admin_bar_html );
}

/**
* Data provider for test_admin_bar_with_tabindex_meta().
*
Expand Down
Loading