Make WordPress Core


Ignore:
Timestamp:
01/27/2026 10:12:40 PM (7 months ago)
Author:
jorbin
Message:

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].

Reviewed-by jorbin.
Merges [61405] to the 6.9 branch.

Props hbhalodia, westonruter, desrosj, albigdd, jorbin.
See #38044.
Fixes #64347.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/6.9/src/wp-admin/includes/export.php

    r60632 r61540  
    240240         * @since 2.1.0
    241241         *
    242          * @param string $str String to wrap in XML CDATA tag.
     242         * @param string|null $str String to wrap in XML CDATA tag. May be null.
    243243         * @return string
    244244         */
    245245        function wxr_cdata( $str ) {
     246                $str = (string) $str;
     247
    246248                if ( ! wp_is_valid_utf8( $str ) ) {
    247249                        $str = utf8_encode( $str );
Note: See TracChangeset for help on using the changeset viewer.