From 71bb091cc3d5b7d950f6add7992b83a1b4e52946 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Sat, 6 Dec 2014 21:23:12 +0000 Subject: [PATCH] Revert [28719] and no longer math-process multiplication of negative numbers see #19308 fixes #30445 props rmccue git-svn-id: https://develop.svn.wordpress.org/trunk@30752 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 4 ++-- tests/phpunit/tests/formatting/WPTexturize.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index d79925074a..9bb1538d80 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -288,9 +288,9 @@ function wptexturize($text, $reset = false) { } // 9x9 (times), but never 0x9999 - if ( 1 === preg_match( '/(?<=\d)x-?\d/', $curl ) ) { + if ( 1 === preg_match( '/(?<=\d)x\d/', $curl ) ) { // Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one! - $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(-?\d[\d\.,]*)\b/', '$1×$2', $curl ); + $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1×$2', $curl ); } } } diff --git a/tests/phpunit/tests/formatting/WPTexturize.php b/tests/phpunit/tests/formatting/WPTexturize.php index 1187f1eb52..8776f44795 100644 --- a/tests/phpunit/tests/formatting/WPTexturize.php +++ b/tests/phpunit/tests/formatting/WPTexturize.php @@ -802,9 +802,10 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase { "-123x1=-123", "-123×1=-123", ), + // @ticket 30445 array( "-123x-1", - "-123×-1", + "-123x-1", ), array( "0.675x1=0.675",