#64351: I found an issue in WordPress version 6.9 when exporting All Content.
--------------------------+-----------------------------
Reporter: mamunur105 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Export | Version: 6.9
Severity: major | Keywords:
Focuses: |
--------------------------+-----------------------------
The export process throws an error related to the wxr_cdata() function.
The problem happens because the function is called with values that are
not always strings — sometimes a meta value is null or another type. When
that happens, the function breaks during export.
[
{{{
04-Dec-2025 07:13:56 UTC] PHP Fatal error: Uncaught TypeError:
wp_is_valid_utf8(): Argument #1 ($bytes) must be of type string, null
given, called in /Users/radiustheme07/Local Sites/shopbuilder/app/public
/wp-admin/includes/export.php on line 246 and defined in
/Users/radiustheme07/Local Sites/shopbuilder/app/public/wp-
includes/utf8.php:39
Stack trace:
#0 /Users/radiustheme07/Local Sites/shopbuilder/app/public/wp-
admin/includes/export.php(246): wp_is_valid_utf8(NULL)
#1 /Users/radiustheme07/Local Sites/shopbuilder/app/public/wp-
admin/includes/export.php(682): wxr_cdata(NULL)
#2 /Users/radiustheme07/Local Sites/shopbuilder/app/public/wp-
admin/export.php(123): export_wp(Array)
#3 {main}
thrown in /Users/radiustheme07/Local Sites/shopbuilder/app/public/wp-
includes/utf8.php on line 39
}}}
To fix it, WordPress should add a simple type check before processing the
value. For example:
{{{#!php
<?php
function wxr_cdata( $str ) {
// Make sure the value is a string before processing.
if ( ! is_string( $str ) ) {
return '<![CDATA[]]>'; // Fail-safe output for invalid or
null values.
}
if ( ! wp_is_valid_utf8( $str ) ) {
$str = utf8_encode( $str );
}
$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str )
. ']]>';
return $str;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64351>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform