
# Conflicts: # .gitignore # vendor/autoload.php # vendor/composer/ClassLoader.php # vendor/composer/LICENSE # vendor/composer/autoload_classmap.php # vendor/composer/autoload_files.php # vendor/composer/autoload_psr4.php # vendor/composer/autoload_real.php # vendor/composer/autoload_static.php # vendor/composer/installed.json # vendor/fgrosse/phpasn1/CHANGELOG.md # vendor/fgrosse/phpasn1/composer.json # vendor/fgrosse/phpasn1/lib/Utility/BigInteger.php # vendor/geoip2/geoip2/CHANGELOG.md # vendor/geoip2/geoip2/composer.json # vendor/geoip2/geoip2/src/Database/Reader.php # vendor/geoip2/geoip2/src/Exception/AddressNotFoundException.php # vendor/geoip2/geoip2/src/Exception/AuthenticationException.php # vendor/geoip2/geoip2/src/Exception/GeoIp2Exception.php # vendor/geoip2/geoip2/src/Exception/HttpException.php # vendor/geoip2/geoip2/src/Exception/InvalidRequestException.php # vendor/geoip2/geoip2/src/Exception/OutOfQueriesException.php # vendor/geoip2/geoip2/src/Model/AbstractModel.php # vendor/geoip2/geoip2/src/Model/AnonymousIp.php # vendor/geoip2/geoip2/src/Model/Asn.php # vendor/geoip2/geoip2/src/Model/City.php # vendor/geoip2/geoip2/src/Model/ConnectionType.php # vendor/geoip2/geoip2/src/Model/Country.php # vendor/geoip2/geoip2/src/Model/Domain.php # vendor/geoip2/geoip2/src/Model/Enterprise.php # vendor/geoip2/geoip2/src/Model/Insights.php # vendor/geoip2/geoip2/src/Model/Isp.php # vendor/geoip2/geoip2/src/ProviderInterface.php # vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php # vendor/geoip2/geoip2/src/Record/AbstractRecord.php # vendor/geoip2/geoip2/src/Record/City.php # vendor/geoip2/geoip2/src/Record/Continent.php # vendor/geoip2/geoip2/src/Record/Country.php # vendor/geoip2/geoip2/src/Record/Location.php # vendor/geoip2/geoip2/src/Record/MaxMind.php # vendor/geoip2/geoip2/src/Record/Postal.php # vendor/geoip2/geoip2/src/Record/RepresentedCountry.php # vendor/geoip2/geoip2/src/Record/Subdivision.php # vendor/geoip2/geoip2/src/Record/Traits.php # vendor/geoip2/geoip2/src/Util.php # vendor/geoip2/geoip2/src/WebService/Client.php # vendor/guzzlehttp/promises/CHANGELOG.md # vendor/guzzlehttp/promises/README.md # vendor/guzzlehttp/promises/composer.json # vendor/guzzlehttp/promises/src/AggregateException.php # vendor/guzzlehttp/promises/src/CancellationException.php # vendor/guzzlehttp/promises/src/Coroutine.php # vendor/guzzlehttp/promises/src/EachPromise.php # vendor/guzzlehttp/promises/src/FulfilledPromise.php # vendor/guzzlehttp/promises/src/Promise.php # vendor/guzzlehttp/promises/src/PromiseInterface.php # vendor/guzzlehttp/promises/src/PromisorInterface.php # vendor/guzzlehttp/promises/src/RejectedPromise.php # vendor/guzzlehttp/promises/src/RejectionException.php # vendor/guzzlehttp/promises/src/TaskQueue.php # vendor/guzzlehttp/promises/src/TaskQueueInterface.php # vendor/guzzlehttp/promises/src/functions.php # vendor/guzzlehttp/psr7/CHANGELOG.md # vendor/guzzlehttp/psr7/README.md # vendor/guzzlehttp/psr7/composer.json # vendor/guzzlehttp/psr7/src/AppendStream.php # vendor/guzzlehttp/psr7/src/BufferStream.php # vendor/guzzlehttp/psr7/src/CachingStream.php # vendor/guzzlehttp/psr7/src/DroppingStream.php # vendor/guzzlehttp/psr7/src/FnStream.php # vendor/guzzlehttp/psr7/src/InflateStream.php # vendor/guzzlehttp/psr7/src/LazyOpenStream.php # vendor/guzzlehttp/psr7/src/LimitStream.php # vendor/guzzlehttp/psr7/src/MessageTrait.php # vendor/guzzlehttp/psr7/src/MultipartStream.php # vendor/guzzlehttp/psr7/src/NoSeekStream.php # vendor/guzzlehttp/psr7/src/PumpStream.php # vendor/guzzlehttp/psr7/src/Request.php # vendor/guzzlehttp/psr7/src/Response.php # vendor/guzzlehttp/psr7/src/ServerRequest.php # vendor/guzzlehttp/psr7/src/Stream.php # vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php # vendor/guzzlehttp/psr7/src/StreamWrapper.php # vendor/guzzlehttp/psr7/src/UploadedFile.php # vendor/guzzlehttp/psr7/src/Uri.php # vendor/guzzlehttp/psr7/src/UriNormalizer.php # vendor/guzzlehttp/psr7/src/UriResolver.php # vendor/guzzlehttp/psr7/src/functions.php # vendor/maxmind-db/reader/CHANGELOG.md # vendor/maxmind-db/reader/composer.json # vendor/maxmind-db/reader/ext/maxminddb.c # vendor/maxmind-db/reader/ext/php_maxminddb.h # vendor/maxmind-db/reader/package.xml # vendor/maxmind/web-service-common/CHANGELOG.md # vendor/maxmind/web-service-common/README.md # vendor/maxmind/web-service-common/composer.json # vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php # vendor/maxmind/web-service-common/src/Exception/HttpException.php # vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php # vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php # vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php # vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php # vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php # vendor/maxmind/web-service-common/src/Exception/WebServiceException.php # vendor/maxmind/web-service-common/src/WebService/Client.php # vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php # vendor/maxmind/web-service-common/src/WebService/Http/Request.php # vendor/maxmind/web-service-common/src/WebService/Http/RequestFactory.php # vendor/paragonie/random_compat/composer.json # vendor/paragonie/sodium_compat/.gitignore # vendor/paragonie/sodium_compat/composer.json # vendor/paragonie/sodium_compat/psalm-above-3.xml # vendor/paragonie/sodium_compat/src/Core/Ed25519.php # vendor/paragonie/sodium_compat/src/Core/SipHash.php # vendor/paragonie/sodium_compat/src/Core/Util.php # vendor/paragonie/sodium_compat/src/Core32/Ed25519.php # vendor/paragonie/sodium_compat/src/File.php # vendor/paragonie/sodium_compat/src/PHP52/SplFixedArray.php # vendor/phpmailer/phpmailer/README.md # vendor/phpmailer/phpmailer/VERSION # vendor/phpmailer/phpmailer/composer.json # vendor/phpmailer/phpmailer/get_oauth_token.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-af.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ar.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-az.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ba.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-be.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-bg.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-cs.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-eo.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-fa.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-fo.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-gl.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-he.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-hr.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-hu.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-hy.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-id.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ka.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ko.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-lt.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-lv.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-mg.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ms.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-nl.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-pl.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-pt.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-sk.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-sr.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-sv.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-tl.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-uk.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-vi.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-zh.php # vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php # vendor/phpmailer/phpmailer/src/Exception.php # vendor/phpmailer/phpmailer/src/OAuth.php # vendor/phpmailer/phpmailer/src/PHPMailer.php # vendor/phpmailer/phpmailer/src/POP3.php # vendor/phpmailer/phpmailer/src/SMTP.php # vendor/spomky-labs/base64url/composer.json # vendor/stripe/stripe-php/CHANGELOG.md # vendor/stripe/stripe-php/VERSION # vendor/stripe/stripe-php/composer.json # vendor/stripe/stripe-php/init.php # vendor/stripe/stripe-php/lib/Account.php # vendor/stripe/stripe-php/lib/ApiRequestor.php # vendor/stripe/stripe-php/lib/ApplicationFeeRefund.php # vendor/stripe/stripe-php/lib/Balance.php # vendor/stripe/stripe-php/lib/BalanceTransaction.php # vendor/stripe/stripe-php/lib/BaseStripeClient.php # vendor/stripe/stripe-php/lib/BitcoinReceiver.php # vendor/stripe/stripe-php/lib/Card.php # vendor/stripe/stripe-php/lib/Charge.php # vendor/stripe/stripe-php/lib/Checkout/Session.php # vendor/stripe/stripe-php/lib/Coupon.php # vendor/stripe/stripe-php/lib/CreditNote.php # vendor/stripe/stripe-php/lib/CreditNoteLineItem.php # vendor/stripe/stripe-php/lib/Customer.php # vendor/stripe/stripe-php/lib/ErrorObject.php # vendor/stripe/stripe-php/lib/Event.php # vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php # vendor/stripe/stripe-php/lib/Invoice.php # vendor/stripe/stripe-php/lib/InvoiceItem.php # vendor/stripe/stripe-php/lib/InvoiceLineItem.php # vendor/stripe/stripe-php/lib/Order.php # vendor/stripe/stripe-php/lib/PaymentIntent.php # vendor/stripe/stripe-php/lib/PaymentMethod.php # vendor/stripe/stripe-php/lib/Payout.php # vendor/stripe/stripe-php/lib/Plan.php # vendor/stripe/stripe-php/lib/PromotionCode.php # vendor/stripe/stripe-php/lib/Refund.php # vendor/stripe/stripe-php/lib/Service/CoreServiceFactory.php # vendor/stripe/stripe-php/lib/Service/CustomerService.php # vendor/stripe/stripe-php/lib/Service/InvoiceService.php # vendor/stripe/stripe-php/lib/Service/PayoutService.php # vendor/stripe/stripe-php/lib/Service/SubscriptionScheduleService.php # vendor/stripe/stripe-php/lib/Service/SubscriptionService.php # vendor/stripe/stripe-php/lib/SetupIntent.php # vendor/stripe/stripe-php/lib/Source.php # vendor/stripe/stripe-php/lib/Stripe.php # vendor/stripe/stripe-php/lib/StripeClient.php # vendor/stripe/stripe-php/lib/StripeObject.php # vendor/stripe/stripe-php/lib/Subscription.php # vendor/stripe/stripe-php/lib/TaxId.php # vendor/stripe/stripe-php/lib/TaxRate.php # vendor/stripe/stripe-php/lib/TransferReversal.php # vendor/stripe/stripe-php/lib/Util/ObjectTypes.php # vendor/stripe/stripe-php/lib/Util/Util.php # vendor/symfony/polyfill-intl-idn/Idn.php # vendor/symfony/polyfill-intl-idn/composer.json # vendor/symfony/polyfill-intl-normalizer/bootstrap.php # vendor/symfony/polyfill-intl-normalizer/composer.json # vendor/symfony/polyfill-php72/Php72.php # vendor/symfony/polyfill-php72/bootstrap.php # vendor/symfony/polyfill-php72/composer.json
222 lines
6.6 KiB
PHP
222 lines
6.6 KiB
PHP
<?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.
|
|
*/
|
|
|
|
namespace Symfony\Polyfill\Php72;
|
|
|
|
/**
|
|
* @author Nicolas Grekas <p@tchwork.com>
|
|
* @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
|
|
*
|
|
* @internal
|
|
*/
|
|
final class Php72
|
|
{
|
|
private static $hashMask;
|
|
|
|
public static function utf8_encode($s)
|
|
{
|
|
$s .= $s;
|
|
$len = \strlen($s);
|
|
|
|
for ($i = $len >> 1, $j = 0; $i < $len; ++$i, ++$j) {
|
|
switch (true) {
|
|
case $s[$i] < "\x80": $s[$j] = $s[$i]; break;
|
|
case $s[$i] < "\xC0": $s[$j] = "\xC2"; $s[++$j] = $s[$i]; break;
|
|
default: $s[$j] = "\xC3"; $s[++$j] = \chr(\ord($s[$i]) - 64); break;
|
|
}
|
|
}
|
|
|
|
return substr($s, 0, $j);
|
|
}
|
|
|
|
public static function utf8_decode($s)
|
|
{
|
|
$s = (string) $s;
|
|
$len = \strlen($s);
|
|
|
|
for ($i = 0, $j = 0; $i < $len; ++$i, ++$j) {
|
|
switch ($s[$i] & "\xF0") {
|
|
case "\xC0":
|
|
case "\xD0":
|
|
$c = (\ord($s[$i] & "\x1F") << 6) | \ord($s[++$i] & "\x3F");
|
|
$s[$j] = $c < 256 ? \chr($c) : '?';
|
|
break;
|
|
|
|
case "\xF0":
|
|
++$i;
|
|
// no break
|
|
|
|
case "\xE0":
|
|
$s[$j] = '?';
|
|
$i += 2;
|
|
break;
|
|
|
|
default:
|
|
$s[$j] = $s[$i];
|
|
}
|
|
}
|
|
|
|
return substr($s, 0, $j);
|
|
}
|
|
|
|
public static function php_os_family()
|
|
{
|
|
if ('\\' === \DIRECTORY_SEPARATOR) {
|
|
return 'Windows';
|
|
}
|
|
|
|
$map = array(
|
|
'Darwin' => 'Darwin',
|
|
'DragonFly' => 'BSD',
|
|
'FreeBSD' => 'BSD',
|
|
'NetBSD' => 'BSD',
|
|
'OpenBSD' => 'BSD',
|
|
'Linux' => 'Linux',
|
|
'SunOS' => 'Solaris',
|
|
);
|
|
|
|
return isset($map[PHP_OS]) ? $map[PHP_OS] : 'Unknown';
|
|
}
|
|
|
|
public static function spl_object_id($object)
|
|
{
|
|
if (null === self::$hashMask) {
|
|
self::initHashMask();
|
|
}
|
|
if (null === $hash = spl_object_hash($object)) {
|
|
return;
|
|
}
|
|
|
|
// On 32-bit systems, PHP_INT_SIZE is 4,
|
|
return self::$hashMask ^ hexdec(substr($hash, 16 - (\PHP_INT_SIZE * 2 - 1), (\PHP_INT_SIZE * 2 - 1)));
|
|
}
|
|
|
|
public static function sapi_windows_vt100_support($stream, $enable = null)
|
|
{
|
|
if (!\is_resource($stream)) {
|
|
trigger_error('sapi_windows_vt100_support() expects parameter 1 to be resource, '.\gettype($stream).' given', E_USER_WARNING);
|
|
|
|
return false;
|
|
}
|
|
|
|
$meta = stream_get_meta_data($stream);
|
|
|
|
if ('STDIO' !== $meta['stream_type']) {
|
|
trigger_error('sapi_windows_vt100_support() was not able to analyze the specified stream', E_USER_WARNING);
|
|
|
|
return false;
|
|
}
|
|
|
|
// We cannot actually disable vt100 support if it is set
|
|
if (false === $enable || !self::stream_isatty($stream)) {
|
|
return false;
|
|
}
|
|
|
|
// The native function does not apply to stdin
|
|
$meta = array_map('strtolower', $meta);
|
|
$stdin = 'php://stdin' === $meta['uri'] || 'php://fd/0' === $meta['uri'];
|
|
|
|
return !$stdin
|
|
&& (false !== getenv('ANSICON')
|
|
|| 'ON' === getenv('ConEmuANSI')
|
|
|| 'xterm' === getenv('TERM')
|
|
|| 'Hyper' === getenv('TERM_PROGRAM'));
|
|
}
|
|
|
|
public static function stream_isatty($stream)
|
|
{
|
|
if (!\is_resource($stream)) {
|
|
trigger_error('stream_isatty() expects parameter 1 to be resource, '.\gettype($stream).' given', E_USER_WARNING);
|
|
|
|
return false;
|
|
}
|
|
|
|
if ('\\' === \DIRECTORY_SEPARATOR) {
|
|
$stat = @fstat($stream);
|
|
// Check if formatted mode is S_IFCHR
|
|
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
|
|
}
|
|
|
|
return \function_exists('posix_isatty') && @posix_isatty($stream);
|
|
}
|
|
|
|
private static function initHashMask()
|
|
{
|
|
$obj = (object) array();
|
|
self::$hashMask = -1;
|
|
|
|
// check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
|
|
$obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush');
|
|
foreach (debug_backtrace(\PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS : false) as $frame) {
|
|
if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && \in_array($frame['function'], $obFuncs)) {
|
|
$frame['line'] = 0;
|
|
break;
|
|
}
|
|
}
|
|
if (!empty($frame['line'])) {
|
|
ob_start();
|
|
debug_zval_dump($obj);
|
|
self::$hashMask = (int) substr(ob_get_clean(), 17);
|
|
}
|
|
|
|
self::$hashMask ^= hexdec(substr(spl_object_hash($obj), 16 - (\PHP_INT_SIZE * 2 - 1), (\PHP_INT_SIZE * 2 - 1)));
|
|
}
|
|
|
|
public static function mb_chr($code, $encoding = null)
|
|
{
|
|
if (0x80 > $code %= 0x200000) {
|
|
$s = \chr($code);
|
|
} elseif (0x800 > $code) {
|
|
$s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
|
|
} elseif (0x10000 > $code) {
|
|
$s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
|
|
} else {
|
|
$s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
|
|
}
|
|
|
|
if ('UTF-8' !== $encoding) {
|
|
$s = mb_convert_encoding($s, $encoding, 'UTF-8');
|
|
}
|
|
|
|
return $s;
|
|
}
|
|
|
|
public static function mb_ord($s, $encoding = null)
|
|
{
|
|
<<<<<<< HEAD
|
|
if (null == $encoding) {
|
|
=======
|
|
if (null === $encoding) {
|
|
>>>>>>> master
|
|
$s = mb_convert_encoding($s, 'UTF-8');
|
|
} elseif ('UTF-8' !== $encoding) {
|
|
$s = mb_convert_encoding($s, 'UTF-8', $encoding);
|
|
}
|
|
|
|
if (1 === \strlen($s)) {
|
|
return \ord($s);
|
|
}
|
|
|
|
$code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
|
|
if (0xF0 <= $code) {
|
|
return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
|
|
}
|
|
if (0xE0 <= $code) {
|
|
return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
|
|
}
|
|
if (0xC0 <= $code) {
|
|
return (($code - 0xC0) << 6) + $s[2] - 0x80;
|
|
}
|
|
|
|
return $code;
|
|
}
|
|
}
|