Update for PHP 7.4

This commit is contained in:
Visman 2019-11-28 20:25:13 +07:00
parent 4c2c686d3e
commit f04c994f7e
9 changed files with 65 additions and 43 deletions

View file

@ -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(

View file

@ -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] . ')';

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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"
}
}

37
composer.lock generated
View file

@ -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": []
}

View file

@ -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 "<?php \$this->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 "<?php include \$this->prepare({$expression}) ?>";

View file

@ -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": {

View file

@ -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;