: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
class wfCurlInterceptionFailedException extends RuntimeException {
class wfCurlInterceptor {
const HOOK_NAME = 'http_api_curl';
private $options = array();
private $requireInterception;
public function __construct($requireInterception = true) {
$this->requireInterception = $requireInterception;
private function reset() {
public function setOption($option, $value) {
$this->options[$option] = $value;
public function getHandle() {
public function handleHook($handle) {
curl_setopt_array($handle, $this->options);
public function intercept($callable) {
$action = array($this, 'handleHook');
add_action(self::HOOK_NAME, $action);
if ($this->handle === null && $this->requireInterception)
throw new wfCurlInterceptionFailedException('Hook was not invoked with a valid cURL handle');
remove_action(self::HOOK_NAME, $action);