Make WordPress Core

Changes between Initial Version and Version 3 of Ticket #62600


Ignore:
Timestamp:
03/05/2025 04:42:49 PM (17 months ago)
Author:
johnbillion
Comment:

This change will need some unit test coverage.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #62600

    • Property Keywords has-patch needs-unit-tests added
    • Property Component GeneralRole/Capability
    • Property Milestone Awaiting ReviewFuture Release
    • Property Version 6.7.1
  • Ticket #62600 – Description

    initial v3  
    11I ran in to a weird issue in a client website claiming it was the theme causing it.  I got a fatal error in every page on the author meta box when using the classic editor layout.
    22
     3{{{
    34Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /home/wp-includes/class-wp-user-query.php:485 Stack trace:
    45#0 /home/wp-includes/class-wp-user-query.php(485): array_filter(NULL)
     
    1112#7 /home/wp-admin/post.php(206): require('/home/...')
    1213#8 {main} thrown in /home/wp-includes/class-wp-user-query.php on line 485
    13 
     14}}}
    1415
    1516It appeared that he some how in the past had a plugin that created user roles with capabilties, but also some without.
     
    2324{{{#!php
    2425<?php
    25                         $role_caps = array_keys( array_filter( $role_data['capabilities'] ) );
     26$role_caps = array_keys( array_filter( $role_data['capabilities'] ) );
    2627}}}
    2728
     
    3132{{{#!php
    3233<?php
    33                         $role_caps = array();
    34                         if ( isset( $role_data['capabilities'] ) ) $role_caps = array_keys( array_filter( $role_data['capabilities'] ) );
     34$role_caps = array();
     35if ( isset( $role_data['capabilities'] ) ) $role_caps = array_keys( array_filter( $role_data['capabilities'] ) );
    3536}}}
    3637