Make WordPress Core

Ticket #30445: 30445.2.diff

File 30445.2.diff, 1.2 KB (added by rmccue, 11 years ago)

Include unit tests

  • src/wp-includes/formatting.php

    diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
    index cf43ea0..a4d62aa 100644
    a b function wptexturize($text, $reset = false) { 
    288288                        }
    289289
    290290                        // 9x9 (times), but never 0x9999
    291                         if ( 1 === preg_match( '/(?<=\d)x-?\d/', $curl ) ) {
     291                        if ( 1 === preg_match( '/(?<=\d)x\d/', $curl ) ) {
    292292                                // Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
    293                                 $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(-?\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
     293                                $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
    294294                        }
    295295                }
    296296        }
  • tests/phpunit/tests/formatting/WPTexturize.php

    diff --git a/tests/phpunit/tests/formatting/WPTexturize.php b/tests/phpunit/tests/formatting/WPTexturize.php
    index 1187f1e..8776f44 100644
    a b class Tests_Formatting_WPTexturize extends WP_UnitTestCase { 
    802802                                "-123x1=-123",
    803803                                "-123&#215;1=-123",
    804804                        ),
     805                        // @ticket 30445
    805806                        array(
    806807                                "-123x-1",
    807                                 "-123&#215;-1",
     808                                "-123x-1",
    808809                        ),
    809810                        array(
    810811                                "0.675x1=0.675",