Make WordPress Core

Ticket #19308: miqro-19308.patch

File miqro-19308.patch, 1.4 KB (added by miqrogroove, 10 years ago)
  • src/wp-includes/formatting.php

     
    173173                        // regular expressions
    174174                        $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    175175
    176                         // 9x9 (times)
     176                        // 9x9 (times), but never 0x9999
    177177                        if ( 1 === preg_match( '/(?<=\d)x\d/', $text ) ) {
    178178                                // Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
    179                                 $curl = preg_replace( '/\b(\d+)x(\d+)\b/', '$1&#215;$2', $curl );
     179                                $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(-?\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
    180180                        }
    181181                }
    182182
  • tests/phpunit/tests/formatting/WPTexturize.php

     
    773773                                "12&#215;34",
    774774                        ),
    775775                        array(
     776                                "-123x1=-123",
     777                                "-123&#215;1=-123",
     778                        ),
     779                        array(
     780                                "-123x-1",
     781                                "-123&#215;-1",
     782                        ),
     783                        array(
     784                                "0.675x1=0.675",
     785                                "0.675&#215;1=0.675",
     786                        ),
     787                        array(
    776788                                "9 x 9",
    777789                                "9 x 9",
    778790                        ),
     791                        array(
     792                                "0x70",
     793                                "0x70",
     794                        ),
     795                        array(
     796                                "3x2x1x0",
     797                                "3x2x1x0",
     798                        ),
    779799                );
    780800        }
    781801