Check all array values for binary data; Remove JSON_PRETTY_PRINT only supported PHP >= 5.4.0

This commit is contained in:
Zach Borboa
2016-08-07 01:40:02 -07:00
parent a32726bc09
commit a48ec2bfff
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -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;
}
}
}
+1 -1
View File
@@ -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']);