mirror of
https://github.com/itflow-org/itflow
synced 2026-06-16 06:41:06 +00:00
Allow PHP-8.2 and up Compatibility instead of just PHP-8.4
This commit is contained in:
@@ -15,13 +15,17 @@ if (\PHP_VERSION_ID >= 80400) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined('CURL_VERSION_HTTP3') || PHP_VERSION_ID < 80200 && function_exists('curl_version') && curl_version()['version'] >= 0x074200) { // libcurl >= 7.66.0
|
||||
if (!defined('CURL_HTTP_VERSION_3')) {
|
||||
define('CURL_HTTP_VERSION_3', 30);
|
||||
}
|
||||
if (\extension_loaded('curl')) {
|
||||
// CURL_VERSION_HTTP3 is defined by PHP 8.2+ when libcurl >= 7.66.0
|
||||
if (defined('CURL_VERSION_HTTP3') || \PHP_VERSION_ID < 80200 && curl_version()['version_number'] >= 0x074200) {
|
||||
if (!defined('CURL_HTTP_VERSION_3')) {
|
||||
define('CURL_HTTP_VERSION_3', 30);
|
||||
}
|
||||
|
||||
if (!defined('CURL_HTTP_VERSION_3ONLY') && defined('CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256')) { // libcurl >= 7.80.0 (7.88 would be better but is slow to check)
|
||||
define('CURL_HTTP_VERSION_3ONLY', 31);
|
||||
// CURL_HTTP_VERSION_3ONLY requires libcurl >= 7.88.0 and is not gated by any PHP-defined constant before 8.4
|
||||
if (!defined('CURL_HTTP_VERSION_3ONLY') && curl_version()['version_number'] >= 0x075800) {
|
||||
define('CURL_HTTP_VERSION_3ONLY', 31);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,32 +49,45 @@ if (!function_exists('fpow')) {
|
||||
function fpow(float $num, float $exponent): float { return p\Php84::fpow($num, $exponent); }
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID < 80000) {
|
||||
require __DIR__.'/bootstrap72.php';
|
||||
}
|
||||
|
||||
if (extension_loaded('mbstring')) {
|
||||
if (!function_exists('mb_ucfirst')) {
|
||||
function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Php84::mb_ucfirst($string, $encoding); }
|
||||
function mb_ucfirst(?string $string, ?string $encoding = null): string { return p\Php84::mb_ucfirst((string) $string, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_lcfirst')) {
|
||||
function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Php84::mb_lcfirst($string, $encoding); }
|
||||
function mb_lcfirst(?string $string, ?string $encoding = null): string { return p\Php84::mb_lcfirst((string) $string, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_trim')) {
|
||||
function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_trim($string, $characters, $encoding); }
|
||||
function mb_trim(?string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_trim((string) $string, $characters, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_ltrim')) {
|
||||
function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_ltrim($string, $characters, $encoding); }
|
||||
function mb_ltrim(?string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_ltrim((string) $string, $characters, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_rtrim')) {
|
||||
function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_rtrim($string, $characters, $encoding); }
|
||||
function mb_rtrim(?string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_rtrim((string) $string, $characters, $encoding); }
|
||||
}
|
||||
}
|
||||
|
||||
if (extension_loaded('bcmath')) {
|
||||
if (!function_exists('bcceil')) {
|
||||
function bcceil(string $num): string { return p\Php84::bcceil($num); }
|
||||
}
|
||||
if (!function_exists('bcdivmod')) {
|
||||
function bcdivmod(string $num1, string $num2, ?int $scale = null): ?array { return p\Php84::bcdivmod($num1, $num2, $scale); }
|
||||
}
|
||||
if (!function_exists('bcfloor')) {
|
||||
function bcfloor(string $num): string { return p\Php84::bcfloor($num); }
|
||||
}
|
||||
if (!function_exists('bcround')) {
|
||||
function bcround(string $num, int $precision = 0, $mode = RoundingMode::HalfAwayFromZero): string { return p\Php84::bcround($num, $precision, $mode); }
|
||||
}
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID >= 80200) {
|
||||
|
||||
Reference in New Issue
Block a user