[buddypress-trac] [BuddyPress Trac] #8319: Block based Activity post form

buddypress-trac noreply at wordpress.org
Tue Jun 18 00:54:26 UTC 2024


#8319: Block based Activity post form
-------------------------+-----------------------
 Reporter:  imath        |       Owner:  imath
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  Up Next
Component:  Activity     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+-----------------------

Comment (by dd32):

 > In [13912]:
 > Introduce theme support check for specific component features

 @imath This has introduced PHP warnings for non-block themes:

 {{{
 E_WARNING: array_keys() expects parameter 1 to be array, bool given in wp-
 content/plugins/buddypress/bp-core/bp-core-theme-compatibility.php:1093
 E_WARNING: array_map(): Expected parameter 2 to be an array, null given in
 wp-content/plugins/buddypress/bp-core/bp-core-theme-compatibility.php:1093
 E_WARNING: array_filter() expects parameter 1 to be array, null given in
 wp-content/plugins/buddypress/bp-core/bp-core-theme-compatibility.php:1093
 }}}

 https://github.com/buddypress/buddypress/blob/f6ebb51eda2c5648f91a18666ccf5068fdca7e0d/src
 /bp-core/bp-core-theme-compatibility.php#L1091-L1093

 What this boils down to is, `$params` is `array()`, `reset( array() )` is
 `false`, `array_keys( false )` is a warning and returns null.

 Quick fix would be
 {{{#!diff
 - $params             = reset( $args );
 + $params             = reset( $args ) ?: [];
 }}}

 or
 {{{#!diff
         $params             = reset( $args );
 -       $is_expected_params = array_filter( array_map( 'is_string',
 array_keys( $params ) ) );
 +       $is_expected_params = $params && array_filter( array_map(
 'is_string', array_keys( $params ) ) );
 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8319#comment:16>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list