Remove PHP v5.x support and add basic doc for how one may install the old version

This commit is contained in:
Zach Borboa
2021-03-17 12:19:38 -04:00
parent 8746d9a5d1
commit cc3f7bac24
40 changed files with 19 additions and 670 deletions
+5 -25
View File
@@ -710,17 +710,7 @@ class Curl
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'POST');
} else {
if (isset($this->options[CURLOPT_CUSTOMREQUEST])) {
if ((version_compare(PHP_VERSION, '5.5.11') < 0)) {
trigger_error(
'Due to technical limitations of PHP <= 5.5.11, it is not possible to '
. 'perform a post-redirect-get request using a php-curl-class Curl object that '
. 'has already been used to perform other types of requests. Either use a new '
. 'php-curl-class Curl object or upgrade your PHP engine.',
E_USER_ERROR
);
} else {
$this->setOpt(CURLOPT_CUSTOMREQUEST, null);
}
$this->setOpt(CURLOPT_CUSTOMREQUEST, null);
}
}
@@ -874,20 +864,10 @@ class Curl
*/
public function setMaxFilesize($bytes)
{
// Make compatible with PHP version both before and after 5.5.0. PHP 5.5.0 added the cURL resource as the first
// argument to the CURLOPT_PROGRESSFUNCTION callback.
$gte_v550 = version_compare(PHP_VERSION, '5.5.0') >= 0;
if ($gte_v550) {
$callback = function ($resource, $download_size, $downloaded, $upload_size, $uploaded) use ($bytes) {
// Abort the transfer when $downloaded bytes exceeds maximum $bytes by returning a non-zero value.
return $downloaded > $bytes ? 1 : 0;
};
} else {
$callback = function ($download_size, $downloaded, $upload_size, $uploaded) use ($bytes) {
return $downloaded > $bytes ? 1 : 0;
};
}
$callback = function ($resource, $download_size, $downloaded, $upload_size, $uploaded) use ($bytes) {
// Abort the transfer when $downloaded bytes exceeds maximum $bytes by returning a non-zero value.
return $downloaded > $bytes ? 1 : 0;
};
$this->progress($callback);
}
-8
View File
@@ -16,14 +16,6 @@ class Decoder
public static function decodeJson()
{
$args = func_get_args();
// Call json_decode() without the $options parameter in PHP
// versions less than 5.4.0 as the $options parameter was added in
// PHP version 5.4.0.
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
$args = array_slice($args, 0, 3);
}
$response = call_user_func_array('json_decode', $args);
if ($response === null) {
$response = $args['0'];
-8
View File
@@ -20,14 +20,6 @@ class Encoder
public static function encodeJson()
{
$args = func_get_args();
// Call json_encode() without the $depth parameter in PHP
// versions less than 5.5.0 as the $depth parameter was added in
// PHP version 5.5.0.
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
$args = array_slice($args, 0, 2);
}
$value = call_user_func_array('json_encode', $args);
if (json_last_error() !== JSON_ERROR_NONE) {
if (function_exists('json_last_error_msg')) {