: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* HTTP API: Requests hook bridge class
* Bridge to connect Requests internal hooks to WordPress actions.
* @see WpOrg\Requests\Hooks
#[AllowDynamicProperties]
class WP_HTTP_Requests_Hooks extends WpOrg\Requests\Hooks {
* @var string Requested URL.
* WordPress WP_HTTP request data.
* @var array Request data in WP_Http format.
protected $request = array();
* @param string $url URL to request.
* @param array $request Request data in WP_Http format.
public function __construct( $url, $request ) {
$this->request = $request;
* Dispatch a Requests hook to a native WordPress action.
* @param string $hook Hook name.
* @param array $parameters Parameters to pass to callbacks.
* @return bool True if hooks were run, false if nothing was hooked.
public function dispatch( $hook, $parameters = array() ) {
$result = parent::dispatch( $hook, $parameters );
// Handle back-compat actions.
/** This action is documented in wp-includes/class-wp-http-curl.php */
do_action_ref_array( 'http_api_curl', array( &$parameters[0], $this->request, $this->url ) );
* Transforms a native Request hook to a WordPress action.
* This action maps Requests internal hook to a native WordPress action.
* @see https://github.com/WordPress/Requests/blob/master/docs/hooks.md
* @param array $parameters Parameters from Requests internal hook.
* @param array $request Request data in WP_Http format.
* @param string $url URL to request.
do_action_ref_array( "requests-{$hook}", $parameters, $this->request, $this->url ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores