We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ac7f6f commit 4cb1436Copy full SHA for 4cb1436
src/Curl/Curl.php
@@ -438,7 +438,14 @@ protected function exec($_ch = null)
438
$ch = $_ch === null ? $this : $_ch;
439
440
$response_headers_fh = fopen('php://memory', 'wb+');
441
- $ch->setOpt(CURLOPT_WRITEHEADER, $response_headers_fh);
+
442
+ // Fallback to storing data in a temporary file when storing data in
443
+ // memory errors with "Warning: curl_setopt(): cannot represent a stream
444
+ // of type MEMORY as a STDIO FILE*".
445
+ if (!@$ch->setOpt(CURLOPT_WRITEHEADER, $response_headers_fh)) {
446
+ $response_headers_fh = fopen('php://temp', 'wb+');
447
+ $ch->setOpt(CURLOPT_WRITEHEADER, $response_headers_fh);
448
+ }
449
450
if ($ch->multi_child) {
451
$ch->raw_response = curl_multi_getcontent($ch->curl);
0 commit comments