Skip to content

Commit 1eb428b

Browse files
committed
General: Escape periods in regular expressions where the character is intended to match only a literal period.
Props westonruter, mukesh27, johnbillion Fixes #63988 git-svn-id: https://develop.svn.wordpress.org/trunk@60783 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 19e8989 commit 1eb428b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/wp-includes/admin-bar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
377377
$blogname = get_bloginfo( 'name' );
378378

379379
if ( ! $blogname ) {
380-
$blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
380+
$blogname = preg_replace( '#^(https?://)?(www\.)?#', '', get_home_url() );
381381
}
382382

383383
if ( is_network_admin() ) {
@@ -698,7 +698,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
698698
$blogname = $blog->blogname;
699699

700700
if ( ! $blogname ) {
701-
$blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
701+
$blogname = preg_replace( '#^(https?://)?(www\.)?#', '', get_home_url() );
702702
}
703703

704704
$menu_id = 'blog-' . $blog->userblog_id;

src/wp-includes/embed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function wp_maybe_load_embeds() {
202202
return;
203203
}
204204

205-
wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' );
205+
wp_embed_register_handler( 'youtube_embed_url', '#https?://(www\.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' );
206206

207207
/**
208208
* Filters the audio embed handler callback.

tests/phpunit/tests/oembed/WpEmbed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function test_wp_embed_unregister_handler() {
100100
$handlers = $GLOBALS['wp_embed']->handlers[10];
101101

102102
// Restore.
103-
wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' );
103+
wp_embed_register_handler( 'youtube_embed_url', '#https?://(www\.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' );
104104

105105
$this->assertArrayNotHasKey( 'youtube_embed_url', $handlers );
106106
}

0 commit comments

Comments
 (0)