Formatting: Add type checking to `_sanitize_text_fields()`.

When a non-string value is passed, return an empty string.

Props Mte90.
Fixes #41450.


Built from https://develop.svn.wordpress.org/trunk@44618


git-svn-id: http://core.svn.wordpress.org/trunk@44449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-01-16 06:05:49 +00:00
parent 63cbfcbded
commit 0bbb277ee4
2 changed files with 5 additions and 1 deletions

View File

@ -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 ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-beta1-44617';
$wp_version = '5.1-beta1-44618';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.