mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 20:20:53 +00:00
Check all array values for binary data; Remove JSON_PRETTY_PRINT only supported PHP >= 5.4.0
This commit is contained in:
+6
-6
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user