diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/class-wp-http-ixr-client.php --- a/wp/wp-includes/class-wp-http-ixr-client.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/class-wp-http-ixr-client.php Tue Dec 15 13:49:49 2020 +0100 @@ -13,21 +13,21 @@ public $error; /** - * @param string $server + * @param string $server * @param string|bool $path - * @param int|bool $port - * @param int $timeout + * @param int|bool $port + * @param int $timeout */ public function __construct( $server, $path = false, $port = false, $timeout = 15 ) { if ( ! $path ) { - // Assume we have been given a URL instead + // Assume we have been given a URL instead. $bits = parse_url( $server ); $this->scheme = $bits['scheme']; $this->server = $bits['host']; $this->port = isset( $bits['port'] ) ? $bits['port'] : $port; $this->path = ! empty( $bits['path'] ) ? $bits['path'] : '/'; - // Make absolutely sure we have a path + // Make absolutely sure we have a path. if ( ! $this->path ) { $this->path = '/'; } @@ -46,10 +46,13 @@ } /** + * @since 3.1.0 + * @since 5.5.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * * @return bool */ - public function query() { - $args = func_get_args(); + public function query( ...$args ) { $method = array_shift( $args ); $request = new IXR_Request( $method, $args ); $xml = $request->getXml(); @@ -62,7 +65,7 @@ 'body' => $xml, ); - // Merge Custom headers ala #8145 + // Merge Custom headers ala #8145. foreach ( $this->headers as $header => $value ) { $args['headers'][ $header ] = $value; } @@ -76,11 +79,11 @@ */ $args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] ); - if ( $this->timeout !== false ) { + if ( false !== $this->timeout ) { $args['timeout'] = $this->timeout; } - // Now send the request + // Now send the request. if ( $this->debug ) { echo '
' . htmlspecialchars( $xml ) . "\n\n\n"; } @@ -103,21 +106,21 @@ echo '
' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n\n\n"; } - // Now parse what we've got back + // Now parse what we've got back. $this->message = new IXR_Message( wp_remote_retrieve_body( $response ) ); if ( ! $this->message->parse() ) { - // XML error + // XML error. $this->error = new IXR_Error( -32700, 'parse error. not well formed' ); return false; } // Is the message a fault? - if ( $this->message->messageType == 'fault' ) { + if ( 'fault' === $this->message->messageType ) { $this->error = new IXR_Error( $this->message->faultCode, $this->message->faultString ); return false; } - // Message must be OK + // Message must be OK. return true; } }