mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Users: Check if the user ID passed as selected to wp_dropdown_users() corresponds to an existing user.
This avoids a few PHP notices if the `include_selected` parameter was specified and a non-existing user ID was passed. Props campusboy1987. Fixes #51370. git-svn-id: https://develop.svn.wordpress.org/trunk@49036 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -129,6 +129,22 @@ class Tests_User_WpDropdownUsers extends WP_UnitTestCase {
|
||||
$this->assertContains( $user1->user_login, $found );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 51370
|
||||
*/
|
||||
public function test_include_selected_with_non_existing_user_id() {
|
||||
$found = wp_dropdown_users(
|
||||
array(
|
||||
'echo' => false,
|
||||
'selected' => PHP_INT_MAX,
|
||||
'include_selected' => true,
|
||||
'show' => 'user_login',
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertNotContains( (string) PHP_INT_MAX, $found );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 38135
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user