WordPress.org

Make WordPress Core

Ticket #44168: 44168.diff

File 44168.diff, 1.5 KB (added by thrijith, 19 months ago)
  • src/wp-admin/includes/ajax-actions.php

     
    951951
    952952        $level = 0;
    953953        if ( is_taxonomy_hierarchical( $taxonomy ) ) {
    954                 $level = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) );
     954                $ancestors = get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' );
     955                $level     = is_countable( $ancestors ) ? count( $ancestors ) : 0;
    955956                ob_start();
    956957                $wp_list_table->single_row( $tag, $level );
    957958                $noparents = ob_get_clean();
     
    42484249
    42494250        ob_start();
    42504251        $wp_list_table->display();
    4251         $status['count'] = count( $wp_list_table->items );
     4252        $status['count'] = is_countable( $wp_list_table->items ) ? count( $wp_list_table->items ) : 0;
    42524253        $status['items'] = ob_get_clean();
    42534254
    42544255        wp_send_json_success( $status );
     
    44004401        }
    44014402
    44024403        // Do we have any registered exporters?
    4403         if ( 0 < count( $exporters ) ) {
     4404        if ( is_countable( $exporters ) && 0 < count( $exporters ) ) {
    44044405                if ( $exporter_index < 1 ) {
    44054406                        wp_send_json_error( __( 'Exporter index cannot be negative.' ) );
    44064407                }
     
    45804581        $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() );
    45814582
    45824583        // Do we have any registered erasers?
    4583         if ( 0 < count( $erasers ) ) {
     4584        if ( is_countable( $erasers ) && 0 < count( $erasers ) ) {
    45844585
    45854586                if ( $eraser_index < 1 ) {
    45864587                        wp_send_json_error( __( 'Eraser index cannot be less than one.' ) );