mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Formatting: Add type checking to _sanitize_text_fields()
.
When a non-string value is passed, return an empty string. Props Mte90. Fixes #41450. git-svn-id: https://develop.svn.wordpress.org/trunk@44618 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
267c79a518
commit
afa551294e
@ -5102,6 +5102,10 @@ function sanitize_textarea_field( $str ) {
|
||||
* @return string Sanitized string.
|
||||
*/
|
||||
function _sanitize_text_fields( $str, $keep_newlines = false ) {
|
||||
if ( ! is_string( $str ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$filtered = wp_check_invalid_utf8( $str );
|
||||
|
||||
if ( strpos( $filtered, '<' ) !== false ) {
|
||||
|
@ -93,6 +93,10 @@ class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
|
||||
'Nested octects %%%ABABAB %A%A%ABBB',
|
||||
'Nested octects',
|
||||
),
|
||||
array(
|
||||
array(),
|
||||
'',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user