Changeset 28942
- Timestamp:
- 07/01/2014 06:00:50 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/kses.php
r28845 r28942 992 992 993 993 /** 994 * Removes any null characters in $string. 994 * Removes any invalid control characters in $string. 995 * 996 * Also removes any instance of the '\0' string. 995 997 * 996 998 * @since 1.0.0 … … 1000 1002 */ 1001 1003 function wp_kses_no_null($string) { 1002 $string = preg_replace('/ \0+/', '', $string);1004 $string = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string); 1003 1005 $string = preg_replace('/(\\\\0)+/', '', $string); 1004 1006 -
trunk/tests/phpunit/tests/kses.php
r26431 r28942 375 375 $this->assertEquals( '∴', wp_kses_normalize_entities( '∴' ) ); 376 376 } 377 378 /** 379 * Test removal of invalid binary data for HTML. 380 * 381 * @ticket 28506 382 * @dataProvider data_ctrl_removal 383 */ 384 function test_ctrl_removal( $input, $output ) { 385 global $allowedposttags; 386 387 return $this->assertEquals( $output, wp_kses( $input, $allowedposttags ) ); 388 } 389 390 function data_ctrl_removal() { 391 return array( 392 array( 393 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\X1C\x1D\x1E\x1F", 394 '', 395 ), 396 array( 397 "\x00h\x01e\x02l\x03l\x04o\x05 \x06w\x07o\x08r\x0Bl\x0Cd\x0E.\x0F \x10W\x11O\x12R\x13D\x14P\x15R\x16E\x17S\x18S\x19 \x1AK\x1BS\X1CE\x1DS\x1E.\x1F/", 398 'hello world. WORDPRESS KSES./', 399 ), 400 array( 401 "\x1F\x1E\x1D\x1C\x1B\x1A\x19\x18\x17\x16\x15\x14\x13\x12\x11\x10\x0F\x0E\x0C\x0B\x08\x07\x06\x05\x04\X03\x02\x01\x00", 402 '', 403 ), 404 array( 405 "\x1Fh\x1Ee\x1Dl\x1Cl\x1Bo\x1A \x19w\x18o\x17r\x16l\x15d\x14.\x13 \x12W\x11O\x10R\x0FD\x0EP\x0CR\x0BE\x08S\x07S\x06 \x05K\x04S\X03E\x02S\x01.\x00/", 406 'hello world. WORDPRESS KSES./', 407 ), 408 array( 409 "\t\r\n word \n\r\t", 410 "\t\r\n word \n\r\t", 411 ), 412 ); 413 } 377 414 }
Note: See TracChangeset
for help on using the changeset viewer.