From f2d98192deeeb6bee110f5041ab1003a52d77bd5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 24 Jul 2020 00:01:32 +0000 Subject: [PATCH] Formatting: Filter out the bullet character in `sanitize_title_with_dashes()`. Props roytanck, deepaklalwani, veromary. Fixes #49791. git-svn-id: https://develop.svn.wordpress.org/trunk@48593 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 2 ++ tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 4b596ea077..9daee4ca71 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -2263,6 +2263,8 @@ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa '%e2%80%9b', '%e2%80%9e', '%e2%80%9f', + // Bullet. + '%e2%80%a2', // ©, ®, °, &hellip, and &trade. '%c2%a9', '%c2%ae', diff --git a/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php b/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php index c3059614e3..4fcce5bb39 100644 --- a/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php +++ b/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php @@ -101,6 +101,13 @@ class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase { $this->assertEquals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe‟', '', 'save' ) ); } + /** + * @ticket 49791 + */ + function test_replaces_bullet() { + $this->assertEquals( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) ); + } + function test_replaces_copy_reg_deg_trade() { $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) ); $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) );