From f04c994f7e45264ec8204dbd4e34b51d9afeabab Mon Sep 17 00:00:00 2001 From: Visman Date: Thu, 28 Nov 2019 20:25:13 +0700 Subject: [PATCH] Update for PHP 7.4 --- app/Core/Lang.php | 14 +++++----- app/Core/Router.php | 6 ++--- app/Core/Secury.php | 2 +- app/Models/BanList/IsBanned.php | 2 +- composer.json | 8 +++++- composer.lock | 37 ++++++++++++++++---------- vendor/artoodetoo/dirk/src/Dirk.php | 4 +-- vendor/composer/installed.json | 33 ++++++++++++++--------- vendor/miovisman/parserus/Parserus.php | 2 +- 9 files changed, 65 insertions(+), 43 deletions(-) diff --git a/app/Core/Lang.php b/app/Core/Lang.php index b26fa6cc..82b7b3e4 100644 --- a/app/Core/Lang.php +++ b/app/Core/Lang.php @@ -132,7 +132,7 @@ class Lang } // заголовки - if (! isset($cur['msgid']{0})) { + if (! isset($cur['msgid'][0])) { if (\preg_match('%Plural\-Forms:\s+nplurals=(\d+);\s*plural=([^;\n\r]+;)%i', $cur[0], $v)) { $nplurals = (int) $v[1]; $plural = \str_replace('n', '$n', \trim($v[2])); @@ -143,18 +143,18 @@ class Lang // перевод } else { // множественный - if (isset($cur['msgid_plural']{0}) || isset($cur[1]{0})) { - if (! isset($cur[1]{0})) { + if (isset($cur['msgid_plural'][0]) || isset($cur[1][0])) { + if (! isset($cur[1][0])) { $cur[1] = $cur['msgid_plural']; } - if (! isset($cur[0]{0})) { + if (! isset($cur[0][0])) { $cur[0] = $cur['msgid']; } $curVal = []; for ($v = 0; $v < $nplurals; ++$v) { - if (! isset($cur[$v]{0})) { + if (! isset($cur[$v][0])) { $curVal = null; break; } @@ -167,7 +167,7 @@ class Lang } // одиночный - } elseif (isset($cur[0])) { // {0} + } elseif (isset($cur[0])) { // [0] $result[$cur['msgid']] = $cur[0]; } } @@ -255,7 +255,7 @@ class Lang */ protected function originalLine($line) { - if (isset($line[1]) && $line[0] == '"' && $line{\strlen($line) - 1} == '"') { + if (isset($line[1]) && $line[0] == '"' && $line[\strlen($line) - 1] == '"') { $line = \substr($line, 1, -1); } return \str_replace( diff --git a/app/Core/Router.php b/app/Core/Router.php index 23fa20e7..755c15a0 100644 --- a/app/Core/Router.php +++ b/app/Core/Router.php @@ -217,8 +217,8 @@ class Router $args = []; foreach ($keys as $key) { - if (isset($matches[$key])) { // ???? может isset($matches[$key]{0}) тут поставить? - $args[$key] = isset($matches[$key]{0}) ? \str_replace($this->subRepl, $this->subSearch, $matches[$key]) : null; + if (isset($matches[$key])) { // ???? может isset($matches[$key][0]) тут поставить? + $args[$key] = isset($matches[$key][0]) ? \str_replace($this->subRepl, $this->subSearch, $matches[$key]) : null; } } return [self::OK, $handler, $args, $marker]; @@ -329,7 +329,7 @@ class Router if (! isset($data[1])) { $data[1] = '[^/\x00-\x1f]+'; } - if ($data[0] === '' || $data[1] === '' || \is_numeric($data[0]{0})) { + if ($data[0] === '' || $data[1] === '' || \is_numeric($data[0][0])) { return false; } $pattern .= '(?P<' . $data[0] . '>' . $data[1] . ')'; diff --git a/app/Core/Secury.php b/app/Core/Secury.php index 9e9a488a..ef0ad72d 100644 --- a/app/Core/Secury.php +++ b/app/Core/Secury.php @@ -119,7 +119,7 @@ class Secury $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; $result = ''; for ($i = 0; $i < $len; ++$i) { - $result .= $chars{\ord($key{$i}) % 64}; + $result .= $chars[\ord($key[$i]) % 64]; } return $result; } diff --git a/app/Models/BanList/IsBanned.php b/app/Models/BanList/IsBanned.php index 5063b4f4..e4515ad2 100644 --- a/app/Models/BanList/IsBanned.php +++ b/app/Models/BanList/IsBanned.php @@ -29,7 +29,7 @@ class IsBanned extends Method return 2; } elseif (false === \strpos($cur['email'], '@')) { $len = \strlen($cur['email']); - if ('.' === $cur['email']{0}) { + if ('.' === $cur['email'][0]) { if (\substr($email, -$len) === $cur['email']) { return 2; } diff --git a/composer.json b/composer.json index 9047c838..32228ede 100644 --- a/composer.json +++ b/composer.json @@ -16,11 +16,17 @@ "ForkBB\\": "app/" } }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/MioVisman/dirk" + } + ], "require": { "php": ">=5.6.12", "ext-gd": "*", "ext-mbstring": "*", - "artoodetoo/dirk": "dev-master", + "artoodetoo/dirk": "dev-visman", "miovisman/parserus": "dev-master" } } diff --git a/composer.lock b/composer.lock index c47ff7a9..ad8a7703 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "683b977706502db4bb7fc7ba3cd8ca71", - "content-hash": "2299621b481bdbc8ce629eee53b1b82e", + "hash": "533b558f4bef9f6e04f96421dd776ab4", + "content-hash": "6646dc09855f04f546d6d92253e01a30", "packages": [ { "name": "artoodetoo/dirk", - "version": "dev-master", + "version": "dev-visman", "source": { "type": "git", - "url": "https://github.com/artoodetoo/dirk.git", - "reference": "e6c2099435d4d4a13d7e96d0170db6182797b5bd" + "url": "https://github.com/MioVisman/dirk.git", + "reference": "05cbba461274158699668c9e8075fb2d8fab5967" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/artoodetoo/dirk/zipball/e6c2099435d4d4a13d7e96d0170db6182797b5bd", - "reference": "e6c2099435d4d4a13d7e96d0170db6182797b5bd", + "url": "https://api.github.com/repos/MioVisman/dirk/zipball/05cbba461274158699668c9e8075fb2d8fab5967", + "reference": "05cbba461274158699668c9e8075fb2d8fab5967", "shasum": "" }, "require": { @@ -33,7 +33,11 @@ "R2\\Templating\\": "src" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "R2\\Templating\\Tests": "tests" + } + }, "license": [ "MIT" ], @@ -51,7 +55,10 @@ "templating", "views" ], - "time": "2017-01-10 21:38:22" + "support": { + "source": "https://github.com/MioVisman/dirk/tree/visman" + }, + "time": "2019-11-28 13:14:33" }, { "name": "miovisman/parserus", @@ -59,12 +66,12 @@ "source": { "type": "git", "url": "https://github.com/MioVisman/Parserus.git", - "reference": "bbdade91cfc4927ebb8b5b984f90a52075f75ece" + "reference": "ac9a8fa047083229f7e50df0342fd3871cdbe931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MioVisman/Parserus/zipball/bbdade91cfc4927ebb8b5b984f90a52075f75ece", - "reference": "bbdade91cfc4927ebb8b5b984f90a52075f75ece", + "url": "https://api.github.com/repos/MioVisman/Parserus/zipball/ac9a8fa047083229f7e50df0342fd3871cdbe931", + "reference": "ac9a8fa047083229f7e50df0342fd3871cdbe931", "shasum": "" }, "require": { @@ -93,7 +100,7 @@ "bbcode", "parser" ], - "time": "2017-11-21 06:34:31" + "time": "2019-10-11 12:06:27" } ], "packages-dev": [], @@ -106,7 +113,9 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6.0" + "php": ">=5.6.12", + "ext-gd": "*", + "ext-mbstring": "*" }, "platform-dev": [] } diff --git a/vendor/artoodetoo/dirk/src/Dirk.php b/vendor/artoodetoo/dirk/src/Dirk.php index 61ea8921..18fbf9e9 100644 --- a/vendor/artoodetoo/dirk/src/Dirk.php +++ b/vendor/artoodetoo/dirk/src/Dirk.php @@ -319,7 +319,7 @@ class Dirk extends PhpEngine */ protected function compileExtends($expression) { - if (isset($expression{0}) && $expression{0} == '(') { + if (isset($expression[0]) && $expression[0] == '(') { $expression = substr($expression, 1, -1); } return "extend({$expression}) ?>"; @@ -333,7 +333,7 @@ class Dirk extends PhpEngine */ protected function compileInclude($expression) { - if (isset($expression{0}) && $expression{0} == '(') { + if (isset($expression[0]) && $expression[0] == '(') { $expression = substr($expression, 1, -1); } return "prepare({$expression}) ?>"; diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 1ad7c0e2..d2cf2db7 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,17 +1,17 @@ [ { "name": "artoodetoo/dirk", - "version": "dev-master", - "version_normalized": "9999999-dev", + "version": "dev-visman", + "version_normalized": "dev-visman", "source": { "type": "git", - "url": "https://github.com/artoodetoo/dirk.git", - "reference": "e6c2099435d4d4a13d7e96d0170db6182797b5bd" + "url": "https://github.com/MioVisman/dirk.git", + "reference": "05cbba461274158699668c9e8075fb2d8fab5967" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/artoodetoo/dirk/zipball/e6c2099435d4d4a13d7e96d0170db6182797b5bd", - "reference": "e6c2099435d4d4a13d7e96d0170db6182797b5bd", + "url": "https://api.github.com/repos/MioVisman/dirk/zipball/05cbba461274158699668c9e8075fb2d8fab5967", + "reference": "05cbba461274158699668c9e8075fb2d8fab5967", "shasum": "" }, "require": { @@ -20,7 +20,7 @@ "require-dev": { "phpunit/phpunit": "4.0.*" }, - "time": "2017-01-10 21:38:22", + "time": "2019-11-28 13:14:33", "type": "library", "installation-source": "dist", "autoload": { @@ -28,7 +28,11 @@ "R2\\Templating\\": "src" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "R2\\Templating\\Tests": "tests" + } + }, "license": [ "MIT" ], @@ -45,7 +49,10 @@ "templates", "templating", "views" - ] + ], + "support": { + "source": "https://github.com/MioVisman/dirk/tree/visman" + } }, { "name": "miovisman/parserus", @@ -54,18 +61,18 @@ "source": { "type": "git", "url": "https://github.com/MioVisman/Parserus.git", - "reference": "bbdade91cfc4927ebb8b5b984f90a52075f75ece" + "reference": "ac9a8fa047083229f7e50df0342fd3871cdbe931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MioVisman/Parserus/zipball/bbdade91cfc4927ebb8b5b984f90a52075f75ece", - "reference": "bbdade91cfc4927ebb8b5b984f90a52075f75ece", + "url": "https://api.github.com/repos/MioVisman/Parserus/zipball/ac9a8fa047083229f7e50df0342fd3871cdbe931", + "reference": "ac9a8fa047083229f7e50df0342fd3871cdbe931", "shasum": "" }, "require": { "php": ">=5.4.0" }, - "time": "2017-11-21 06:34:31", + "time": "2019-10-11 12:06:27", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/miovisman/parserus/Parserus.php b/vendor/miovisman/parserus/Parserus.php index 6ec64c27..39222f1a 100644 --- a/vendor/miovisman/parserus/Parserus.php +++ b/vendor/miovisman/parserus/Parserus.php @@ -1082,7 +1082,7 @@ class Parserus $body = ''; foreach ($this->data[$id]['children'] as $cid) { $child = $this->getText($cid); - if (isset($body{0}, $child{0})) { + if (isset($body[0], $child[0])) { $body .= ' ' . $child; } else { $body .= $child;