Skip to content

Commit 0a739e2

Browse files
jamiecuthillJamie Cuthill
authored andcommitted
Reset request on curl_reset
1 parent 92f6753 commit 0a739e2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/VCR/CodeTransform/CurlCodeTransform.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class CurlCodeTransform extends AbstractCodeTransform
1515
'/(?<!::|->|\w_)\\\?curl_multi_add_handle\s*\(/i' => '\VCR\LibraryHooks\CurlHook::curl_multi_add_handle(',
1616
'/(?<!::|->|\w_)\\\?curl_multi_remove_handle\s*\(/i' => '\VCR\LibraryHooks\CurlHook::curl_multi_remove_handle(',
1717
'/(?<!::|->|\w_)\\\?curl_multi_exec\s*\(/i' => '\VCR\LibraryHooks\CurlHook::curl_multi_exec(',
18-
'/(?<!::|->|\w_)\\\?curl_multi_info_read\s*\(/i' => '\VCR\LibraryHooks\CurlHook::curl_multi_info_read('
18+
'/(?<!::|->|\w_)\\\?curl_multi_info_read\s*\(/i' => '\VCR\LibraryHooks\CurlHook::curl_multi_info_read(',
19+
'/(?<!::|->|\w_)\\\?curl_reset\s*\(/i' => '\VCR\LibraryHooks\CurlHook::curl_reset('
1920
);
2021

2122
/**

src/VCR/LibraryHooks/CurlHook.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ public static function __callStatic($method, $args)
154154
return \call_user_func_array(array(__CLASS__, $localMethod), $args);
155155
}
156156

157+
public static function curlReset($curlHandle)
158+
{
159+
\curl_reset($curlHandle);
160+
self::$requests[(int) $curlHandle] = new Request('GET', null);
161+
self::$curlOptions[(int) $curlHandle] = array();
162+
}
163+
157164
/**
158165
* Initialize a cURL session.
159166
*

0 commit comments

Comments
 (0)