Skip to content

Commit cb14d22

Browse files
XML-RPC: Correct argument mismatch in ::_multisite_getUsersBlogs().
This ensures that `::wp_getUsersBlogs()` receives the valid authentication arguments when called from `::blogger_getUsersBlogs()` via `::_multisite_getUsersBlogs()`. Follow-up to [54468]. Props sainathpoojary, SergeyBiryukov. Fixes #65536. git-svn-id: https://develop.svn.wordpress.org/trunk@62572 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0853070 commit cb14d22

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

src/wp-includes/class-wp-xmlrpc-server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4892,7 +4892,7 @@ protected function _multisite_getUsersBlogs( $args ) {
48924892
$domain = $current_blog->domain;
48934893
$path = $current_blog->path . 'xmlrpc.php';
48944894

4895-
$blogs = $this->wp_getUsersBlogs( $args );
4895+
$blogs = $this->wp_getUsersBlogs( array( $args[1], $args[2] ) );
48964896
if ( $blogs instanceof IXR_Error ) {
48974897
return $blogs;
48984898
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/**
4+
* @group xmlrpc
5+
* @group user
6+
*/
7+
class Tests_XMLRPC_blogger_getUsersBlogs extends WP_XMLRPC_UnitTestCase {
8+
9+
/**
10+
* @ticket 65536
11+
* @group ms-required
12+
* @group multisite
13+
*/
14+
public function test_multisite_argument_parsing() {
15+
$subscriber_id = $this->make_user_by_role( 'subscriber' );
16+
17+
$result = $this->myxmlrpcserver->blogger_getUsersBlogs( array( 1, 'subscriber', 'subscriber' ) );
18+
19+
$this->assertNotIXRError( $result, 'The result should not be an instance of IXR_Error.' );
20+
$this->assertIsArray( $result, 'The result should be an array.' );
21+
$this->assertNotEmpty( $result, 'The result should not be empty.' );
22+
23+
$blog = $result[0];
24+
$this->assertArrayHasKey( 'url', $blog, 'The result should include the url field.' );
25+
$this->assertArrayHasKey( 'blogid', $blog, 'The result should include the blogid field.' );
26+
$this->assertArrayHasKey( 'blogName', $blog, 'The result should include the blogName field.' );
27+
}
28+
}

0 commit comments

Comments
 (0)