mirror of
https://github.com/itflow-org/itflow
synced 2026-06-21 09:11:05 +00:00
Allow PHP-8.2 and up Compatibility instead of just PHP-8.4
This commit is contained in:
84
plugins/vendor/symfony/polyfill-php83/Php83.php
vendored
84
plugins/vendor/symfony/polyfill-php83/Php83.php
vendored
@@ -32,7 +32,7 @@ final class Php83
|
||||
}
|
||||
|
||||
if ($depth > self::JSON_MAX_DEPTH) {
|
||||
throw new \ValueError(sprintf('json_validate(): Argument #2 ($depth) must be less than %d', self::JSON_MAX_DEPTH));
|
||||
throw new \ValueError(\sprintf('json_validate(): Argument #2 ($depth) must be less than %d', self::JSON_MAX_DEPTH));
|
||||
}
|
||||
|
||||
json_decode($json, true, $depth, $flags);
|
||||
@@ -40,29 +40,38 @@ final class Php83
|
||||
return \JSON_ERROR_NONE === json_last_error();
|
||||
}
|
||||
|
||||
public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null): string
|
||||
/** @return string|false */
|
||||
public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null)
|
||||
{
|
||||
if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) {
|
||||
throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH');
|
||||
}
|
||||
|
||||
if (null === $encoding) {
|
||||
$encoding = mb_internal_encoding();
|
||||
}
|
||||
|
||||
$errorToTrigger = null;
|
||||
try {
|
||||
$validEncoding = @mb_check_encoding('', $encoding);
|
||||
if (!@mb_check_encoding('', $encoding)) {
|
||||
$errorToTrigger = \sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding);
|
||||
}
|
||||
} catch (\ValueError $e) {
|
||||
throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding));
|
||||
$errorToTrigger = \sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding);
|
||||
}
|
||||
|
||||
// BC for PHP 7.3 and lower
|
||||
if (!$validEncoding) {
|
||||
throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding));
|
||||
if (null === $errorToTrigger && mb_strlen($pad_string, $encoding) <= 0) {
|
||||
$errorToTrigger = 'mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string';
|
||||
}
|
||||
|
||||
if (mb_strlen($pad_string, $encoding) <= 0) {
|
||||
throw new \ValueError('mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string');
|
||||
if (null === $errorToTrigger && !\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) {
|
||||
$errorToTrigger = 'mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH';
|
||||
}
|
||||
|
||||
if (null !== $errorToTrigger) {
|
||||
if (80000 > \PHP_VERSION_ID) {
|
||||
trigger_error($errorToTrigger, \E_USER_WARNING);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new \ValueError($errorToTrigger);
|
||||
}
|
||||
|
||||
$paddingRequired = $length - mb_strlen($string, $encoding);
|
||||
@@ -94,34 +103,33 @@ final class Php83
|
||||
throw new \ValueError('str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters');
|
||||
}
|
||||
|
||||
if (is_numeric($string)) {
|
||||
$offset = stripos($string, 'e');
|
||||
if (false !== $offset) {
|
||||
$char = $string[$offset];
|
||||
++$char;
|
||||
$string[$offset] = $char;
|
||||
++$string;
|
||||
for ($i = \strlen($string) - 1; $i >= 0; --$i) {
|
||||
$char = $string[$i];
|
||||
|
||||
switch ($string[$offset]) {
|
||||
case 'f':
|
||||
$string[$offset] = 'e';
|
||||
break;
|
||||
case 'F':
|
||||
$string[$offset] = 'E';
|
||||
break;
|
||||
case 'g':
|
||||
$string[$offset] = 'f';
|
||||
break;
|
||||
case 'G':
|
||||
$string[$offset] = 'F';
|
||||
break;
|
||||
}
|
||||
|
||||
return $string;
|
||||
if ('z' === $char) {
|
||||
$string[$i] = 'a';
|
||||
continue;
|
||||
}
|
||||
if ('Z' === $char) {
|
||||
$string[$i] = 'A';
|
||||
continue;
|
||||
}
|
||||
if ('9' === $char) {
|
||||
$string[$i] = '0';
|
||||
continue;
|
||||
}
|
||||
|
||||
$string[$i] = \chr(\ord($char) + 1);
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
return ++$string;
|
||||
switch ($string[0]) {
|
||||
case 'a': return 'a'.$string;
|
||||
case 'A': return 'A'.$string;
|
||||
}
|
||||
|
||||
return '1'.$string;
|
||||
}
|
||||
|
||||
public static function str_decrement(string $string): string
|
||||
@@ -135,7 +143,7 @@ final class Php83
|
||||
}
|
||||
|
||||
if (preg_match('/\A(?:0[aA0]?|[aA])\z/', $string)) {
|
||||
throw new \ValueError(sprintf('str_decrement(): Argument #1 ($string) "%s" is out of decrement range', $string));
|
||||
throw new \ValueError(\sprintf('str_decrement(): Argument #1 ($string) "%s" is out of decrement range', $string));
|
||||
}
|
||||
|
||||
if (!\in_array(substr($string, -1), ['A', 'a', '0'], true)) {
|
||||
|
||||
@@ -19,12 +19,6 @@ if (!function_exists('json_validate')) {
|
||||
function json_validate(string $json, int $depth = 512, int $flags = 0): bool { return p\Php83::json_validate($json, $depth, $flags); }
|
||||
}
|
||||
|
||||
if (extension_loaded('mbstring')) {
|
||||
if (!function_exists('mb_str_pad')) {
|
||||
function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Php83::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('stream_context_set_options')) {
|
||||
function stream_context_set_options($context, array $options): bool { return stream_context_set_option($context, $options); }
|
||||
}
|
||||
@@ -37,12 +31,22 @@ if (!function_exists('str_decrement')) {
|
||||
function str_decrement(string $string): string { return p\Php83::str_decrement($string); }
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID < 80000) {
|
||||
require __DIR__.'/bootstrap72.php';
|
||||
}
|
||||
|
||||
if (extension_loaded('mbstring')) {
|
||||
if (!function_exists('mb_str_pad')) {
|
||||
function mb_str_pad(?string $string, ?int $length, ?string $pad_string = ' ', ?int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Php83::mb_str_pad((string) $string, (int) $length, (string) $pad_string, (int) $pad_type, $encoding); }
|
||||
}
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID >= 80100) {
|
||||
return require __DIR__.'/bootstrap81.php';
|
||||
}
|
||||
|
||||
if (!function_exists('ldap_exop_sync') && function_exists('ldap_exop')) {
|
||||
function ldap_exop_sync($ldap, string $request_oid, ?string $request_data = null, ?array $controls = null, &$response_data = null, &$response_oid = null): bool { return ldap_exop($ldap, $request_oid, $request_data, $controls, $response_data, $response_oid); }
|
||||
function ldap_exop_sync($ldap, string $request_oid, ?string $request_data = null, ?array $controls = null, &$response_data = null, &$response_oid = null): bool { return ldap_exop($ldap, $request_oid, $request_data, $response_data, $response_oid); }
|
||||
}
|
||||
|
||||
if (!function_exists('ldap_connect_wallet') && function_exists('ldap_connect')) {
|
||||
|
||||
19
plugins/vendor/symfony/polyfill-php83/bootstrap72.php
vendored
Normal file
19
plugins/vendor/symfony/polyfill-php83/bootstrap72.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Polyfill\Php83 as p;
|
||||
|
||||
if (extension_loaded('mbstring')) {
|
||||
if (!function_exists('mb_str_pad')) {
|
||||
/** @return string|false */
|
||||
function mb_str_pad(?string $string, ?int $length, ?string $pad_string = ' ', ?int $pad_type = STR_PAD_RIGHT, ?string $encoding = null) { return p\Php83::mb_str_pad((string) $string, (int) $length, (string) $pad_string, (int) $pad_type, $encoding); }
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,30 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Polyfill\Php83 as p;
|
||||
|
||||
if (\PHP_VERSION_ID >= 80300) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!function_exists('json_validate')) {
|
||||
function json_validate(string $json, int $depth = 512, int $flags = 0): bool { return p\Php83::json_validate($json, $depth, $flags); }
|
||||
}
|
||||
|
||||
if (!function_exists('str_increment')) {
|
||||
function str_increment(string $string): string { return p\Php83::str_increment($string); }
|
||||
}
|
||||
|
||||
if (!function_exists('str_decrement')) {
|
||||
function str_decrement(string $string): string { return p\Php83::str_decrement($string); }
|
||||
}
|
||||
|
||||
if (extension_loaded('mbstring') && !function_exists('mb_str_pad')) {
|
||||
function mb_str_pad(?string $string, ?int $length, ?string $pad_string = ' ', ?int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Php83::mb_str_pad((string) $string, (int) $length, (string) $pad_string, (int) $pad_type, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('ldap_exop_sync') && function_exists('ldap_exop')) {
|
||||
function ldap_exop_sync(\LDAP\Connection $ldap, string $request_oid, ?string $request_data = null, ?array $controls = null, &$response_data = null, &$response_oid = null): bool { return ldap_exop($ldap, $request_oid, $request_data, $controls, $response_data, $response_oid); }
|
||||
function ldap_exop_sync(\LDAP\Connection $ldap, string $request_oid, ?string $request_data = null, ?array $controls = null, &$response_data = null, &$response_oid = null): bool { return ldap_exop($ldap, $request_oid, $request_data, $response_data, $response_oid); }
|
||||
}
|
||||
|
||||
if (!function_exists('ldap_connect_wallet') && function_exists('ldap_connect')) {
|
||||
|
||||
Reference in New Issue
Block a user