mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-05 16:08:12 +01:00
In wptexturize()
, don't convert C-style hexadecimals to mathematical ×
.
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
This commit is contained in:
parent
12e7d6744b
commit
4666c1abe2
@ -180,10 +180,10 @@ function wptexturize($text) {
|
|||||||
// regular expressions
|
// regular expressions
|
||||||
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
|
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
|
||||||
|
|
||||||
// 9x9 (times)
|
// 9x9 (times), but never 0x9999
|
||||||
if ( 1 === preg_match( '/(?<=\d)x\d/', $text ) ) {
|
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!
|
// 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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user