From 4666c1abe25550269bf3aa9dd651cfb009849a58 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 10 Jun 2014 02:18:15 +0000 Subject: [PATCH] =?UTF-8?q?In=20`wptexturize()`,=20don't=20convert=20C-sty?= =?UTF-8?q?le=20hexadecimals=20to=20mathematical=20`=C3=97`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds unit tests. Props harrym, kurtpayne, miqrogroove. Fixes #19308. Built from https://develop.svn.wordpress.org/trunk@28719 git-svn-id: http://core.svn.wordpress.org/trunk@28533 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 3086a092e8..be2292502b 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -180,10 +180,10 @@ function wptexturize($text) { // regular expressions $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); - // 9x9 (times) - if ( 1 === preg_match( '/(?<=\d)x\d/', $text ) ) { + // 9x9 (times), but never 0x9999 + if ( 1 === preg_match( '/(?<=\d)x-?\d/', $text ) ) { // Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one! - $curl = preg_replace( '/\b(\d+)x(\d+)\b/', '$1×$2', $curl ); + $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(-?\d[\d\.,]*)\b/', '$1×$2', $curl ); } }