Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/13/2022 08:21:06 AM (22 months ago)
Author:
imath
Message:

Avoid various PHP 8.1 deprecated notices

Here are the treated deprecated notices:

  • ctype_digit() Argument of type int will be interpreted as string in the future.
  • Automatic conversion of false to array.
  • Passing null to strtotime() $datetime parameter.

Props renatonascalves, rafiahmedd

See #8649

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-avatars.php

    r13311 r13312  
    811811
    812812        /** This filter is documented in bp-core/bp-core-avatars.php */
    813         $item_id = apply_filters( 'bp_core_avatar_item_id', $args['item_id'], $args['object'] );
     813        $item_id = (int) apply_filters( 'bp_core_avatar_item_id', $args['item_id'], $args['object'] );
    814814    } else {
    815         $item_id = $args['item_id'];
    816     }
    817 
    818     if ( $item_id && ( ctype_digit( $item_id ) || is_int( $item_id ) ) ) {
    819         $item_id = (int) $item_id;
    820     } else {
     815        $item_id = (int) str_replace( '.', '', $args['item_id'] );
     816    }
     817
     818    if ( ! $item_id ) {
    821819        return false;
    822820    }
Note: See TracChangeset for help on using the changeset viewer.