diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index e690948ea2..38cd23c95e 100644
|
a
|
b
|
function force_balance_tags( $text ) { |
| 2465 | 2465 | // WP bug fix for LOVE <3 (and other situations with '<' before a number) |
| 2466 | 2466 | $text = preg_replace( '#<([0-9]{1})#', '<$1', $text ); |
| 2467 | 2467 | |
| 2468 | | while ( preg_match( '/<(\/?[\w:]*)\s*([^>]*)>/', $text, $regex ) ) { |
| | 2468 | while ( preg_match( '/<(\/?[\w:\-]*)\s*([^>]*)>/', $text, $regex ) ) { |
| 2469 | 2469 | $newtext .= $tagqueue; |
| 2470 | 2470 | |
| 2471 | 2471 | $i = strpos( $text, $regex[0] ); |
diff --git a/tests/phpunit/tests/formatting/balanceTags.php b/tests/phpunit/tests/formatting/balanceTags.php
index 783c320780..f479d84d26 100644
|
a
|
b
|
class Tests_Formatting_BalanceTags extends WP_UnitTestCase { |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| | 224 | /** |
| | 225 | * Get custom element data. |
| | 226 | * |
| | 227 | * @return array Data. |
| | 228 | */ |
| | 229 | public function get_custom_element_data() { |
| | 230 | return array( |
| | 231 | array( |
| | 232 | '<my-custom-element>Test</my-custom-element>', |
| | 233 | '<my-custom-element>Test</my-custom-element>', |
| | 234 | ), |
| | 235 | array( |
| | 236 | '<my-custom-element>Test', |
| | 237 | '<my-custom-element>Test</my-custom-element>', |
| | 238 | ), |
| | 239 | array( |
| | 240 | 'Test</my-custom-element>', |
| | 241 | 'Test', |
| | 242 | ), |
| | 243 | array( |
| | 244 | '</my-custom-element>Test', |
| | 245 | 'Test', |
| | 246 | ), |
| | 247 | ); |
| | 248 | } |
| | 249 | |
| | 250 | /** |
| | 251 | * Test custom elements. |
| | 252 | * |
| | 253 | * @ticket 47014 |
| | 254 | * @dataProvider get_custom_element_data() |
| | 255 | * |
| | 256 | * @param string $source Source. |
| | 257 | * @param string $expected Expected. |
| | 258 | */ |
| | 259 | public function test_custom_elements( $source, $expected ) { |
| | 260 | $this->assertEquals( $expected, balanceTags( $source, true ) ); |
| | 261 | } |
| 224 | 262 | } |