Skip to:
Content

BuddyPress.org

Opened 2 years ago

Closed 23 months ago

#7634 closed defect (bug) (fixed)

PHP 7.2 compatibility

Reported by: netweb Owned by:
Milestone: 2.9.2 Priority: normal
Severity: normal Version:
Component: Core Keywords: needs-patch
Cc:

Description

Following [11753] the PHP 7.2, 6 tests in the PHP 7.2 Travis CIjobs are failing:

e.g. https://travis-ci.org/buddypress/BuddyPress/jobs/309634382:

There were 6 errors:


1) BP_Tests_Media_Extractor::test_extract_media_from_a_wp_post

count(): Parameter must be an array or an object that implements Countable


/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:3259

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:2102

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-actions.php:704

/tmp/wordpress/src/wp-includes/class-wp-hook.php:286

/tmp/wordpress/src/wp-includes/class-wp-hook.php:310

/tmp/wordpress/src/wp-includes/plugin.php:453

/tmp/wordpress/src/wp-includes/post.php:4038

/tmp/wordpress/src/wp-includes/post.php:3498

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-post.php:27

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-thing.php:32

/tmp/wordpress/src/wp-content/plugins/BuddyPress/tests/phpunit/testcases/core/class-bp-media-extractor.php:152


2) BP_Tests_Media_Extractor::test_extract_images_from_content_with_galleries_variant_no_ids

count(): Parameter must be an array or an object that implements Countable


/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:3259

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:2102

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-actions.php:704

/tmp/wordpress/src/wp-includes/class-wp-hook.php:286

/tmp/wordpress/src/wp-includes/class-wp-hook.php:310

/tmp/wordpress/src/wp-includes/plugin.php:453

/tmp/wordpress/src/wp-includes/post.php:4038

/tmp/wordpress/src/wp-includes/post.php:3498

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-post.php:27

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-thing.php:32

/tmp/wordpress/src/wp-content/plugins/BuddyPress/tests/phpunit/testcases/core/class-bp-media-extractor.php:303


3) BP_Tests_Media_Extractor::test_extract_no_images_from_content_with_invalid_galleries_variant_no_ids

count(): Parameter must be an array or an object that implements Countable


/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:3259

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:2102

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-actions.php:704

/tmp/wordpress/src/wp-includes/class-wp-hook.php:286

/tmp/wordpress/src/wp-includes/class-wp-hook.php:310

/tmp/wordpress/src/wp-includes/plugin.php:453

/tmp/wordpress/src/wp-includes/post.php:4038

/tmp/wordpress/src/wp-includes/post.php:3498

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-post.php:27

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-thing.php:32

/tmp/wordpress/src/wp-content/plugins/BuddyPress/tests/phpunit/testcases/core/class-bp-media-extractor.php:344


4) BP_Tests_Media_Extractor::test_extract_no_images_from_content_with_featured_image

count(): Parameter must be an array or an object that implements Countable


/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:3259

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:2102

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-actions.php:704

/tmp/wordpress/src/wp-includes/class-wp-hook.php:286

/tmp/wordpress/src/wp-includes/class-wp-hook.php:310

/tmp/wordpress/src/wp-includes/plugin.php:453

/tmp/wordpress/src/wp-includes/post.php:4038

/tmp/wordpress/src/wp-includes/post.php:3498

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-post.php:27

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-thing.php:32

/tmp/wordpress/src/wp-content/plugins/BuddyPress/tests/phpunit/testcases/core/class-bp-media-extractor.php:371


5) BP_Tests_Media_Extractor::test_extract_images_from_content_without_featured_image

count(): Parameter must be an array or an object that implements Countable


/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:3259

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-functions.php:2102

/tmp/wordpress/src/wp-content/plugins/BuddyPress/src/bp-activity/bp-activity-actions.php:704

/tmp/wordpress/src/wp-includes/class-wp-hook.php:286

/tmp/wordpress/src/wp-includes/class-wp-hook.php:310

/tmp/wordpress/src/wp-includes/plugin.php:453

/tmp/wordpress/src/wp-includes/post.php:4038

/tmp/wordpress/src/wp-includes/post.php:3498

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-post.php:27

/tmp/wordpress/tests/phpunit/includes/factory/class-wp-unittest-factory-for-thing.php:32

/tmp/wordpress/src/wp-content/plugins/BuddyPress/tests/phpunit/testcases/core/class-bp-media-extractor.php:392


6) BP_Tests_Members_Functions::test_bp_last_activity_migrate

count(): Parameter must be an array or an object that implements Countable


/tmp/wordpress/src/wp-includes/meta.php:194

/tmp/wordpress/src/wp-includes/user.php:825

/tmp/wordpress/src/wp-content/plugins/BuddyPress/tests/phpunit/testcases/members/functions.php:364

Related: #WP40109

Attachments (1)

7634.diff (5.7 KB) - added by boonebgorges 2 years ago.

Download all attachments as: .zip

Change History (14)

#1 @DJPaul
2 years ago

The media extractor one was fixed the other day.
The rest, I think this is upstream WordPress. Going to look at it.

#2 @boonebgorges
2 years ago

We need to do a review for create_function() calls. http://php.net/manual/en/migration72.deprecated.php

#3 @boonebgorges
2 years ago

In 11768:

Members: Fix PHP 7.2 notice in 'last_activity' usermeta filter.

A new PHP notice in 7.2 shows what has long been a bug: when
_bp_get_user_meta_last_activity_warning() filters get_user_metadata,
it does not obey the $single parameter. This is now fixed.

See #7634.

@boonebgorges
2 years ago

#4 @boonebgorges
2 years ago

7634.diff converts all remaining calls to create_function() with closures. This could use a review.

I think we should probably be porting these back to the 2.9 branch, since PHP 7.2 has been released. Anyone have strong feelings about this?

#5 @boonebgorges
2 years ago

In 11769:

Exclude unsupported PHPUnit/WP combinations from Travis matrix.

Previously: [11283].

See #7383, #7634.

#6 @DJPaul
2 years ago

(Backporting to 2.9 branch) I think it's a great idea, it'll make the next minor release fab.

#7 @DJPaul
2 years ago

7634.diff patch:

class-bp-group-extension.php

  • The closure containing bp_groups_admin_meta_box_content_, $group_id needs to be passed in.

ajax.php

  • The closure for bp_messages_recipients(), we need to rename $r to $username.

#8 @boonebgorges
2 years ago

  • Milestone changed from 3.0 to 2.9.2

#9 @boonebgorges
2 years ago

In 11772:

Members: Fix PHP 7.2 notice in 'last_activity' usermeta filter.

A new PHP notice in 7.2 shows what has long been a bug: when
_bp_get_user_meta_last_activity_warning() filters get_user_metadata,
it does not obey the $single parameter. This is now fixed.

Merges [11768] to the 2.9 branch.

See #7634.

#10 @boonebgorges
2 years ago

In 11773:

Remove calls to create_function().

create_function() is deprecated in PHP 7.2.

See #7634.

#11 @boonebgorges
2 years ago

In 11774:

Remove calls to create_function().

create_function() is deprecated in PHP 7.2.

Merges [11773] to the 2.9 branch.

See #7634.

#12 @DJPaul
2 years ago

Travis/master is passing, so I assume work here is complete?

#13 @DJPaul
23 months ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.