PHP Warning: SimpleXMLElement::asXML()

for some time now I am receiving this warning on two of my sites:

PHP Warning: SimpleXMLElement::asXML(): xmlEscapeEntities : char out of range in /home/wksxspir/public_html/mysite.com/wp-includes/embed.php on line 700

    * @param array            $data The original oEmbed response data.
 * @param SimpleXMLElement $node Optional. XML node to append the result to recursively.
 * @return string|false XML string on success, false on error.
 */
function _oembed_create_xml( $data, $node = null ) {
    if ( ! is_array( $data ) || empty( $data ) ) {
        return false;
    }

    if ( null === $node ) {
        $node = new SimpleXMLElement( '<oembed></oembed>' );
    }

    foreach ( $data as $key => $value ) {
        if ( is_numeric( $key ) ) {
            $key = 'oembed';
        }

        if ( is_array( $value ) ) {
            $item = $node->addChild( $key );
            _oembed_create_xml( $value, $item );
        } else {
            $node->addChild( $key, esc_html( $value ) );
        }
    }

    return $node->asXML();
}

This is a part of the code, line 700 has this: return $node->asXML();

What should I do, any suggestions?

Read more here: PHP Warning: SimpleXMLElement::asXML()

Leave a Reply

Your email address will not be published. Required fields are marked *