Make WordPress Core

Changeset 28719

Timestamp:
06/10/2014 02:17:24 AM (10 years ago)
Author:
wonderboymusic
Message:

In wptexturize(), don't convert C-style hexadecimals to mathematical ×.

Adds unit tests.

Props harrym, kurtpayne, miqrogroove.
Fixes #19308.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r28718 r28719  
    181181            $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    182182
    183             // 9x9 (times)
    184             if ( 1 === preg_match( '/(?<=\d)x\d/', $text ) ) {
     183            // 9x9 (times)
     184            if ( 1 === preg_match( '/(?<=\d)x\d/', $text ) ) {
    185185                // Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
    186                 $curl = preg_replace( '/\b(\d+)x(\d+)\b/', '$1&#215;$2', $curl );
     186                $curl = preg_replace( '/\b(\d)\b/', '$1&#215;$2', $curl );
    187187            }
    188188        }
  • trunk/tests/phpunit/tests/formatting/WPTexturize.php

    r28718 r28719  
    782782            ),
    783783            array(
     784
     785
     786
     787
     788
     789
     790
     791
     792
     793
     794
     795
    784796                "9 x 9",
    785797                "9 x 9",
    786798            ),
     799
     800
     801
     802
     803
     804
     805
     806
    787807        );
    788808    }
Note: See TracChangeset for help on using the changeset viewer.