diff --git a/wp-includes/functions.php b/wp-includes/functions.php index a48b4bfc86..7f57d234c1 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -820,6 +820,7 @@ function xmlrpc_removepostdata( $content ) { * Use RegEx to extract URLs from arbitrary content. * * @since 3.7.0 + * @since 6.0.0 Fixes support for HTML entities (Trac 30580). * * @param string $content Content to extract URLs from. * @return string[] Array of URLs found in passed string. @@ -833,7 +834,7 @@ function wp_extract_urls( $content ) { . '(?:' . '\([\w\d]+\)|' . '(?:' - . "[^`!()\[\]{};:'\".,<>«»“”‘’\s]|" + . "[^`!()\[\]{}:'\".,<>«»“”‘’\s]|" . '(?:[:]\d+)?/?' . ')+' . ')' @@ -842,7 +843,17 @@ function wp_extract_urls( $content ) { $post_links ); - $post_links = array_unique( array_map( 'html_entity_decode', $post_links[2] ) ); + $post_links = array_unique( + array_map( + static function( $link ) { + // Decode to replace valid entities, like &. + $link = html_entity_decode( $link ); + // Maintain backward compatibility by removing extraneous semi-colons (`;`). + return str_replace( ';', '', $link ); + }, + $post_links[2] + ) + ); return array_values( $post_links ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index eea44f30e2..e44aa07dcd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-53043'; +$wp_version = '6.0-alpha-53044'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.