WordPress.org

Make WordPress Core

Ticket #43583: 43583-improvements.patch

File 43583-improvements.patch, 1.1 KB (added by ayeshrajans, 3 years ago)
  • src/wp-includes/compat.php

    diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php
    index cabe71d211..afad31d054 100644
    a b function array_replace_recursive( $base = array(), $replacements = array() ) { 
    520520         * @return bool True if `$var` is countable, false otherwise.
    521521         */
    522522        function is_countable( $var ) {
    523                 return ( is_array( $var ) || $var instanceof Countable );
     523                return ( is_array( $var ) || ( is_object( $var ) && ( $var instanceof \Countable || $var instanceof \SimpleXMLElement || $var instanceof \ResourceBundle ) ) );
    524524        }
    525525}
    526526
  • tests/phpunit/tests/compat.php

    diff --git a/tests/phpunit/tests/compat.php b/tests/phpunit/tests/compat.php
    index 0f17b2d7a8..750a472889 100644
    a b public function countable_variable_test_data() { 
    228228                        array( array( 1, 2, 3 ), true ),
    229229                        array( (array) 1, true ),
    230230                        array( (object) array( 'foo', 'bar', 'baz' ), false ),
     231                        array( new SimpleXMLElement('<xml><tag>1</tag><tag>2</tag></xml>'), true),
    231232                );
    232233        }
    233234