Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/13/2022 08:21:06 AM (2 years 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-activity/classes/class-bp-activity-activity.php

    r13184 r13312  
    12411241        );
    12421242
    1243         $where_args = false;
     1243        $where_args = array();
    12441244
    12451245        if ( ! empty( $r['user_id'] ) ) {
     
    15681568        }
    15691569
    1570         $comments = wp_cache_get( $activity_id, 'bp_activity_comments' );
     1570        $comments       = array();
     1571        $comments_cache = wp_cache_get( $activity_id, 'bp_activity_comments' );
    15711572
    15721573        // We store the string 'none' to cache the fact that the
    15731574        // activity item has no comments.
    1574         if ( 'none' === $comments ) {
    1575             $comments = false;
     1575        if ( 'none' === $comments_cache ) {
     1576            return false;
    15761577
    15771578            // A true cache miss.
    1578         } elseif ( empty( $comments ) ) {
     1579        } elseif ( empty( $comments_cache ) ) {
    15791580
    15801581            $bp = buddypress();
     
    16901691            }
    16911692
    1692             // If we cache a value of false, it'll count as a cache
     1693            // If we cache an empty array, it'll count as a cache
    16931694            // miss the next time the activity comments are fetched.
    16941695            // Storing the string 'none' is a hack workaround to
    16951696            // avoid unnecessary queries.
    1696             if ( false === $comments ) {
     1697            if ( ! $comments ) {
    16971698                $cache_value = 'none';
    16981699            } else {
     
    17011702
    17021703            wp_cache_set( $activity_id, $cache_value, 'bp_activity_comments' );
     1704        } else {
     1705            $comments = (array) $comments_cache;
    17031706        }
    17041707
Note: See TracChangeset for help on using the changeset viewer.