From ee4170bf5c9f5e2be587ab1ebd7090daf19c89c4 Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Thu, 4 Dec 2025 17:18:58 +0530 Subject: [PATCH 1/2] Typecast the input param to string for typesaftey and fix fatal --- src/wp-admin/includes/export.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php index 9d5903a98c5c3..a0143485f6391 100644 --- a/src/wp-admin/includes/export.php +++ b/src/wp-admin/includes/export.php @@ -243,6 +243,8 @@ function export_wp( $args = array() ) { * @return string */ function wxr_cdata( $str ) { + $str = (string) $str; + if ( ! wp_is_valid_utf8( $str ) ) { $str = utf8_encode( $str ); } From ca33f7659c5f67b0b6e62bfebbfda001c01dad05 Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Fri, 5 Dec 2025 10:24:07 +0530 Subject: [PATCH 2/2] Early return if the incoming data is not a string --- src/wp-admin/includes/export.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php index a0143485f6391..031d4123025fa 100644 --- a/src/wp-admin/includes/export.php +++ b/src/wp-admin/includes/export.php @@ -243,7 +243,9 @@ function export_wp( $args = array() ) { * @return string */ function wxr_cdata( $str ) { - $str = (string) $str; + if ( ! is_string( $str ) ) { + return ''; + } if ( ! wp_is_valid_utf8( $str ) ) { $str = utf8_encode( $str );