diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index d1655b5..d83a008 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -156,14 +156,14 @@ class Curl // the @filename API or CURLFile usage. This also fixes the warning "curl_setopt(): The usage of the // @filename API for file uploading is deprecated. Please use the CURLFile class instead". Ignore // non-file values prefixed with the @ character. - if (class_exists('CURLFile')) { - foreach ($data as $key => $value) { - if (is_string($value) && strpos($value, '@') === 0 && is_file(substr($value, 1))) { - $binary_data = true; + foreach ($data as $key => $value) { + if (is_string($value) && strpos($value, '@') === 0 && is_file(substr($value, 1))) { + $binary_data = true; + if (class_exists('CURLFile')) { $data[$key] = new \CURLFile(substr($value, 1)); - } else if ($value instanceof \CURLFile) { - $binary_data = true; } + } else if ($value instanceof \CURLFile) { + $binary_data = true; } } } diff --git a/tests/PHPCurlClass/server.php b/tests/PHPCurlClass/server.php index f851357..558e0f7 100644 --- a/tests/PHPCurlClass/server.php +++ b/tests/PHPCurlClass/server.php @@ -117,7 +117,7 @@ if ($test === 'http_basic_auth') { echo json_encode(array( 'post' => $_POST, 'files' => $_FILES, - ), JSON_PRETTY_PRINT); + )); exit; } elseif ($test === 'post_file_path_upload') { echo Helper\mime_type($_FILES[$key]['tmp_name']);