Commit 4ab8f3d7f2 for wordpress.org
commit 4ab8f3d7f278dad1abde3efd22f71625ba64bb4b
Author: Weston Ruter <weston@xwp.co>
Date: Wed Dec 24 06:48:31 2025 +0000
Export: Fix fatal error when passing `null` to `wxr_cdata()` by casting passed value to `string`.
This ensures that `wp_is_valid_utf8()` does not cause a type error since it only accepts strings.
Developed in https://github.com/WordPress/wordpress-develop/pull/10595
Follow-up to [60630].
Props hbhalodia, westonruter, desrosj, albigdd, jorbin.
See #38044.
Fixes #64347.
Built from https://develop.svn.wordpress.org/trunk@61405
git-svn-id: http://core.svn.wordpress.org/trunk@60717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php
index 4fe697e7e6..a77cb804f0 100644
--- a/wp-admin/includes/export.php
+++ b/wp-admin/includes/export.php
@@ -239,10 +239,12 @@ function export_wp( $args = array() ) {
*
* @since 2.1.0
*
- * @param string $str String to wrap in XML CDATA tag.
+ * @param string|null $str String to wrap in XML CDATA tag. May be null.
* @return string
*/
function wxr_cdata( $str ) {
+ $str = (string) $str;
+
if ( ! wp_is_valid_utf8( $str ) ) {
$str = utf8_encode( $str );
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index af45aca00b..89877fd01c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61404';
+$wp_version = '7.0-alpha-61405';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.