Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/16/2025 04:24:03 PM (10 months ago)
Author:
espellcaste
Message:

Code Modernization: address the only, so far, two issues related to PHP 8.5.

  • Instances of using null as an array offset.
  • ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated.

Reference: ​https://wiki.php.net/rfc/deprecations_php_8_5\#deprecate_arrayobject_and_arrayiterator_with_objects

Developed in ​https://github.com/buddypress/buddypress/pull/425

Follow-up to [14147].

Props espellcaste.

See #9313 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/activity/functions/bpActivityGetCommentDepth.php

    r11737 r14149  
    4141                bp_has_activities( 'display_comments=threaded' );
    4242
    43                 // Loop through activity comments generated in activity loop.
    44                 $recursive = new RecursiveIteratorIterator( new RecursiveArrayIterator( $GLOBALS['activities_template']->activities[0]->children ), RecursiveIteratorIterator::SELF_FIRST );
    45                 foreach ( $recursive as $aid => $a ) {
    46                         if ( ! is_numeric( $aid ) || ! is_object( $a ) ) {
     43                $children = $GLOBALS['activities_template']->activities[0]->children;
     44
     45                foreach ( array( $comment_one, $comment_one_one, $comment_two ) as $aid ) {
     46                        $a = BP_Activity_Activity::find_comment_in_tree( $children, $aid );
     47
     48                        if ( false === $a ) {
    4749                                continue;
    4850                        }
    … …  
    6668                                        break;
    6769                        }
    68 
    6970                }
    7071
Note: See TracChangeset for help on using the changeset viewer.