Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection: XMLRPC_Connector can never work #13136

Closed
mdawaffe opened this issue Jul 26, 2019 · 1 comment · Fixed by #13139
Closed

Connection: XMLRPC_Connector can never work #13136

mdawaffe opened this issue Jul 26, 2019 · 1 comment · Fixed by #13139
Assignees
Labels
Connect Flow Connection banners, buttons, ...
Milestone

Comments

@mdawaffe
Copy link
Member

b52fa91 introduced Connection Connectors.

When the site is not yet active, the XML-RPC Connector is instantiated at

new XMLRPC_Connector( $this->connection_manager );

This adds an XML-RPC method: jetpack.verifyRegistration:

/**
* Attached to the `xmlrpc_methods` filter.
*
* @param array $methods The already registered XML-RPC methods.
* @return array
*/
public function xmlrpc_methods( $methods ) {
return array_merge(
$methods,
array(
'jetpack.verifyRegistration' => array( $this, 'verify_registration' ),
)
);
}

However, the next line in class.jetpack.php clears all existing XML-RPC methods since Jetpack_XMLRPC_Server::bootstrap_xmlrpc_methods does not filter its input but instead outputs only its own methods:

/**
* Whitelist of the bootstrap XML-RPC methods
*/
function bootstrap_xmlrpc_methods() {
return array(
'jetpack.remoteAuthorize' => array( $this, 'remote_authorize' ),
'jetpack.remoteRegister' => array( $this, 'remote_register' ),
);
}

Thus, when WordPress.com tries to use the jetpack.verifyRegistration method, it always fail, and WordPress.com always falls back to the REST Connector.

@mdawaffe mdawaffe added the Connect Flow Connection banners, buttons, ... label Jul 26, 2019
@mdawaffe mdawaffe added this to the 7.6 milestone Jul 26, 2019
@mdawaffe mdawaffe self-assigned this Jul 26, 2019
@oskosk
Copy link
Contributor

oskosk commented Jul 26, 2019

Related #13084

mdawaffe added a commit that referenced this issue Jul 26, 2019
…Methods

The bootstrap filter clears out all existing XML-RPC methods, so adding
the connector methods first does not work.

With this new order, the connector's methods are appended to the bootstrap
methods.

Fixes #13136, #13084.
jeherve pushed a commit that referenced this issue Jul 29, 2019
…Methods

The bootstrap filter clears out all existing XML-RPC methods, so adding
the connector methods first does not work.

With this new order, the connector's methods are appended to the bootstrap
methods.

Fixes #13136, #13084.
zinigor pushed a commit that referenced this issue Jul 30, 2019
…Methods (#13139)

* Connection: Instantiate the XML-RPC Connector after adding Bootstrap Methods

The bootstrap filter clears out all existing XML-RPC methods, so adding
the connector methods first does not work.

With this new order, the connector's methods are appended to the bootstrap
methods.

Fixes #13136, #13084.

* Adds tests. Refactor required.

* Fixed expectations to make tests pass.

* Require some XML-RPC methods, allow others, forbid the rest.
mdawaffe added a commit to Automattic/jetpack-addons that referenced this issue Jul 30, 2019
Because of the XML-RPC Registration bug in Jetpack 7.5.x, all Jetpack
7.5.x sites register via REST Registration. If a site has a problem
with the REST API, the site can't register.

This plugin ensures that XML-RPC Registration is available.

Automattic/jetpack#13136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Connect Flow Connection banners, buttons, ...
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants