Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/wp-admin/includes/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ function export_wp( $args = array() ) {
* @return string
*/
function wxr_cdata( $str ) {
$str = (string) $str;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be safer:

Suggested change
$str = (string) $str;
if ( ! is_string( $str ) ) {
$str = '';
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of even, why not just:

Suggested change
$str = (string) $str;
if ( ! is_string( $str ) ) {
return '';
}

If the value is an empty string, there's nothing needing to be wrapped in a CDATA section.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


if ( ! wp_is_valid_utf8( $str ) ) {
$str = utf8_encode( $str );
}
Expand Down
Loading