improvement(bootstrap): small compat fixes for WIN_NT on PHP 8.1

This commit is contained in:
celestora 2024-03-30 12:29:50 +02:00
parent c4fb793333
commit 939ea30262
3 changed files with 160 additions and 256 deletions

View file

@ -200,7 +200,7 @@ function ovk_strftime_safe(string $format, ?int $timestamp = NULL): string
{ {
$sessionOffset = intval(Session::i()->get("_timezoneOffset")); $sessionOffset = intval(Session::i()->get("_timezoneOffset"));
$str = strftime($format, $timestamp + ($sessionOffset * MINUTE) * -1 ?? time() + ($sessionOffset * MINUTE) * -1, tr("__locale") !== '@__locale' ? tr("__locale") : NULL); $str = strftime($format, $timestamp + ($sessionOffset * MINUTE) * -1 ?? time() + ($sessionOffset * MINUTE) * -1, tr("__locale") !== '@__locale' ? tr("__locale") : NULL);
if(PHP_SHLIB_SUFFIX === "dll") { if(PHP_SHLIB_SUFFIX === "dll" && version_compare(PHP_VERSION, "8.1.0", "<")) {
$enc = tr("__WinEncoding"); $enc = tr("__WinEncoding");
if($enc === "@__WinEncoding") if($enc === "@__WinEncoding")
$enc = "Windows-1251"; $enc = "Windows-1251";
@ -232,7 +232,7 @@ function ovk_is_ssl(): bool
return $GLOBALS["requestIsSSL"]; return $GLOBALS["requestIsSSL"];
} }
function parseAttachments(string $attachments) function parseAttachments(string $attachments): array
{ {
$attachmentsArr = explode(",", $attachments); $attachmentsArr = explode(",", $attachments);
$returnArr = []; $returnArr = [];
@ -249,9 +249,10 @@ function parseAttachments(string $attachments)
elseif(str_contains($attachment, "audio")) elseif(str_contains($attachment, "audio"))
$attachmentType = "audio"; $attachmentType = "audio";
$attachmentIds = str_replace($attachmentType, "", $attachment); $attachmentIds = str_replace($attachmentType, "", $attachment);
$attachmentOwner = (int)explode("_", $attachmentIds)[0]; $attachmentOwner = (int) explode("_", $attachmentIds)[0];
$attachmentId = (int)end(explode("_", $attachmentIds)); $gatoExplotano = explode("_", $attachmentIds);
$attachmentId = (int) end($gatoExplotano);
switch($attachmentType) { switch($attachmentType) {
case "photo": case "photo":

View file

@ -2,7 +2,6 @@
"require": { "require": {
"php": "~7.3||~8.1", "php": "~7.3||~8.1",
"guzzlehttp/guzzle": "^6.5", "guzzlehttp/guzzle": "^6.5",
"komeiji-satori/curl": "dev-master",
"whichbrowser/parser": "dev-master", "whichbrowser/parser": "dev-master",
"james-heinrich/getid3": "^1.9@dev", "james-heinrich/getid3": "^1.9@dev",
"rybakit/msgpack": "dev-master", "rybakit/msgpack": "dev-master",
@ -11,7 +10,7 @@
"ezyang/htmlpurifier": "dev-master", "ezyang/htmlpurifier": "dev-master",
"scssphp/scssphp": "dev-main", "scssphp/scssphp": "dev-main",
"lfkeitel/phptotp": "dev-master", "lfkeitel/phptotp": "dev-master",
"chillerlan/php-qrcode": "dev-main", "chillerlan/php-qrcode": "5.0.2",
"vearutop/php-obscene-censor-rus": "dev-master", "vearutop/php-obscene-censor-rus": "dev-master",
"erusev/parsedown": "dev-master", "erusev/parsedown": "dev-master",
"bhaktaraz/php-rss-generator": "dev-master", "bhaktaraz/php-rss-generator": "dev-master",
@ -20,7 +19,8 @@
"symfony/console": "5.4.x-dev", "symfony/console": "5.4.x-dev",
"wapmorgan/morphos": "dev-master", "wapmorgan/morphos": "dev-master",
"ext-sodium": "*", "ext-sodium": "*",
"php81_bc/strftime": "^0.0.2" "php81_bc/strftime": "^0.0.2",
"ext-iconv": "*"
}, },
"minimum-stability": "dev" "minimum-stability": "beta"
} }

397
composer.lock generated

File diff suppressed because it is too large Load diff