WordPress.org

Make WordPress Core

Ticket #32729: 34182.diff

File 34182.diff, 1.5 KB (added by jgrodel, 5 years ago)
  • src/wp-includes/formatting.php

    diff --git src/wp-includes/formatting.php src/wp-includes/formatting.php
    index e0b45fd..fd3faf1 100644
    function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa 
    16081608                $title = str_replace( '%c3%97', 'x', $title );
    16091609        }
    16101610
     1611        $title = str_replace('+', '', $title);
     1612        $title = str_replace('=', '', $title);
    16111613        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
    16121614        $title = preg_replace('/\s+/', '-', $title);
    16131615        $title = preg_replace('|-+|', '-', $title);
  • tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php

    diff --git tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php
    index 80be941..b1a5046 100644
    class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase { 
    114114                $this->assertEquals("aaaa", sanitize_title_with_dashes("ááa´aˊ", '', 'save'));
    115115        }
    116116
     117        /**
     118         * @ticket 32729
     119         */
     120        function test_removes_pluses() {
     121                $this->assertEquals("1+2", sanitize_title_with_dashes("12", '', 'save'));
     122                $this->assertEquals("math-is-hard-34", sanitize_title_with_dashes("math is hard 3+4+", '', 'save'));
     123        }
     124
     125        /**
     126         * @ticket 32729
     127         */
     128        function test_removes_equal_signs() {
     129                $this->assertEquals("5=6", sanitize_title_with_dashes("56", '', 'save'));
     130                $this->assertEquals("math-is-hard-77", sanitize_title_with_dashes("math is hard 7=7", '', 'save'));
     131        }
    117132}