Skip to content

Commit

Permalink
Update php version to 8.2 (#8)
Browse files Browse the repository at this point in the history
* update to php8.2, update phpunit, fix tests

* fix

* upd symfony

* fixes DI, cache, smarty

* small fixes

* removed exceptions in json_decode and json_encode, changelog, change version

* fix cache application, upd ApplicationInterface, delete final in Application, fix spaces

* fix spaces

---------

Co-authored-by: Yury Bushenko <[email protected]>
  • Loading branch information
Nastro and Yury Bushenko authored Aug 24, 2023
1 parent c6c6056 commit ee93907
Show file tree
Hide file tree
Showing 277 changed files with 12,164 additions and 12,512 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
composer.lock
*.iml
.idea
*.cache
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Change log

## [3.0.0] 2023-08-23
- Обновлена версия php до 8.2
- Обновление phpunit/phpunit до 9.0 lock = `9.6.11`
- Обновление friendsofphp/php-cs-fixer до 3.23 lock = `3.23.0`
- Обновлены мажорные версии зависимостей symfony:
- `symfony/http-foundation` `^6.0` lock = `6.3.2`
https://github.com/symfony/http-foundation/blob/master/CHANGELOG.md
- `symfony/console` `^6.0` lock = `6.3.2`
https://github.com/symfony/console/blob/master/CHANGELOG.md
- `symfony/event-dispatcher` `^6.0` lock = `6.3.2`
https://github.com/symfony/event-dispatcher/blob/master/CHANGELOG.md
- `symfony/yaml` `^6.0` lock = `6.3.3`
https://github.com/symfony/var-dumper/blob/master/CHANGELOG.md
- `symfony/config` `^6.0` lock = `6.3.2`
https://github.com/symfony/config/blob/master/CHANGELOG.md
- `symfony/dependency-injection` `^6.0` lock = `6.3.2`
https://github.com/symfony/dependency-injection/blob/master/CHANGELOG.md
- `symfony/finder` `^6.0` lock = `6.3.3`
https://github.com/symfony/finder/blob/6.3/CHANGELOG.md
- `symfony/cache` `^6.0` lock = `6.3.2`
https://github.com/symfony/cache/blob/6.3/CHANGELOG.md

## [2.4.11] 2023-03-20
- Исправлено поведение плагина `PXPluginFilters` для полей линейки `PXDisplayTypeDropdown`, у которых отсутствуют загруженные значения для построения выпадающего списка. Для таких полей теперь используется обычный input.

Expand Down
27 changes: 15 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,29 @@
],
"config": {
"platform": {
"php": "7.2"
"php": "8.2"
},
"allow-plugins": {
"dalee/pp-installers": true
}
},
"bin": [
"bin/pp"
],
"require": {
"php": ">=7.2",
"php": "^8.2",
"dalee/pp-installers": "~1.0.5",
"monolog/monolog": "^1.19",
"symfony/http-foundation": "~3.4",
"symfony/http-foundation": "^6.0",
"ramsey/uuid": "^3.5",
"symfony/console": "~3.4",
"symfony/event-dispatcher": "~3.4",
"symfony/yaml": "~3.4",
"symfony/console": "^6.0",
"symfony/event-dispatcher": "^6.0",
"symfony/yaml": "^6.0",
"vlucas/phpdotenv": "^2.4",
"symfony/config": "~3.4",
"symfony/dependency-injection": "~3.4",
"symfony/finder": "~3.4",
"symfony/cache": "~3.4",
"symfony/config": "^6.0",
"symfony/dependency-injection": "^6.0",
"symfony/finder": "^6.0",
"symfony/cache": "^6.0",
"predis/predis": "^1.1",
"ext-json": "*",
"ext-pcntl": "*",
Expand All @@ -44,8 +47,8 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"friendsofphp/php-cs-fixer": "^2.7"
"phpunit/phpunit": "^9.0",
"friendsofphp/php-cs-fixer": "^3.23"
},
"autoload": {
"psr-4": {
Expand Down
117 changes: 57 additions & 60 deletions htdocs/admin/tools/vendor/ckeditor/samples/old/assets/posteddata.php
Original file line number Diff line number Diff line change
@@ -1,60 +1,57 @@
<!DOCTYPE html>
<?php
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
?>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sample &mdash; CKEditor</title>
<link rel="stylesheet" href="sample.css">
<meta name="description" content="Try the latest sample of CKEditor 4 and learn more about customizing your WYSIWYG editor with endless possibilities.">
</head>
<body>
<h1 class="samples">
CKEditor &mdash; Posted Data
</h1>
<table border="1" cellspacing="0" id="outputSample">
<colgroup><col width="120"></colgroup>
<thead>
<tr>
<th>Field&nbsp;Name</th>
<th>Value</th>
</tr>
</thead>
<?php

if (!empty($_POST))
{
foreach ( $_POST as $key => $value )
{
if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
continue;

if ( get_magic_quotes_gpc() )
$value = htmlspecialchars( stripslashes((string)$value) );
else
$value = htmlspecialchars( (string)$value );
?>
<tr>
<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
<td><pre class="samples"><?php echo $value; ?></pre></td>
</tr>
<?php
}
}
?>
</table>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="https://ckeditor.com/">https://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2020, <a class="samples" href="https://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<?php
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
?>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sample &mdash; CKEditor</title>
<link rel="stylesheet" href="sample.css">
<meta name="description" content="Try the latest sample of CKEditor 4 and learn more about customizing your WYSIWYG editor with endless possibilities.">
</head>
<body>
<h1 class="samples">
CKEditor &mdash; Posted Data
</h1>
<table border="1" cellspacing="0" id="outputSample">
<colgroup><col width="120"></colgroup>
<thead>
<tr>
<th>Field&nbsp;Name</th>
<th>Value</th>
</tr>
</thead>
<?php

if (!empty($_POST))
{
foreach ( $_POST as $key => $value )
{
if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
continue;

$value = htmlspecialchars( (string)$value );
?>
<tr>
<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
<td><pre class="samples"><?php echo $value; ?></pre></td>
</tr>
<?php
}
}
?>
</table>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="https://ckeditor.com/">https://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2020, <a class="samples" href="https://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion lib/Acl/acl.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class PXObjectsACL
if (!$loadAll) {
$query .= " WHERE (sgroupid IS NULL";

if ($this->user && count($this->user->groups)) {
if ($this->user && (is_countable($this->user->groups) ? count($this->user->groups) : 0)) {
$query .= ' or sgroupid IN (' . implode(',', $this->user->groups) . ')';
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Acl/object.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ObjectChecker {

if ((bool)$parentFormat->parent) {
$this->_loadParent($format, $object, $pKey);
$object['parent'] = isset($this->acl->parents[$pKey]) ? $this->acl->parents[$pKey] : null;
$object['parent'] = $this->acl->parents[$pKey] ?? null;
}

return $this->_checkGroup($what, $parentFormat, $object);
Expand All @@ -73,7 +73,7 @@ class ObjectChecker {

$tmpParents = $this->acl->db->query('SELECT parent FROM ' . $format->parent . ' WHERE id = ' . $object['parent']);

if (count($tmpParents)) {
if (is_countable($tmpParents) ? count($tmpParents) : 0) {
$this->acl->parents[$pKey] = current(current($tmpParents));
}
}
Expand Down
14 changes: 7 additions & 7 deletions lib/Common/functions.array.inc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function array_transpose($array) {
* @param bool $strict
* @return array resulting array with selected keys
*/
function array_remap($array, $map, $strict = false) {
function array_remap($array, mixed $map, $strict = false) {
if (!is_string($map) && !is_array($map)) {
return false;
}
Expand All @@ -176,7 +176,7 @@ function array_remap($array, $map, $strict = false) {
}

foreach ($map as $k => $v) {
$result[$k] = isset($array[$v]) ? $array[$v] : null;
$result[$k] = $array[$v] ?? null;
}

return $result;
Expand All @@ -186,7 +186,7 @@ function array_deep_diff($d1, $d2, $excludeKeys) {
switch (true) {
case is_array($d1) && is_array($d2) :
$diff = [];
foreach (array_unique(array_merge(array_keys($d1), array_keys($d2))) as $key) {
foreach (array_unique([...array_keys($d1), ...array_keys($d2)]) as $key) {
if (is_array($excludeKeys) && in_array($key, $excludeKeys)) {
continue;
}
Expand Down Expand Up @@ -243,7 +243,7 @@ function array_deep_diff($d1, $d2, $excludeKeys) {
* array_flat($arr, 'c', true); // array( 'oof' => 'x', 'zzz' => 'y', '123' => 'z', ... )
* array_flat($arr, false, array('a', 'c')); // array( array('a' => 'foo', 'c' => 'oof'), array('a' => 'bar', 'c' => 'zzz'), ... )
*/
function array_flat($array, $toKey = false, $toValue = false, $unique = false) {
function array_flat($array, $toKey = false, mixed $toValue = false, $unique = false) {

if (!is_array($array)) {
return false;
Expand Down Expand Up @@ -327,7 +327,7 @@ function array_keys_grouped($array) {
* @param bool $strict Использовать строгое (true) или нестрогое (false) сравнение при поиске элемента.
* @return array Список из двух элементов - предыдущего и последующего.
*/
function findNeighborElements($list, $current, $circular = true, $strict = true) {
function findNeighborElements($list, mixed $current, $circular = true, $strict = true) {

$inList = &$list; // Иначе foreach не меняет указатель массива по завершению, что ломает весь алгоритм

Expand Down Expand Up @@ -371,7 +371,7 @@ function findNeighborElements($list, $current, $circular = true, $strict = true)
*
* @return array Таблица из строк, для которых в заданном столбце ячейка имеет заданное значение. Если ничего не найдено, то пустой массив.
*/
function getRowsFromTable($array, $colName, $colValues, $strict = true, $count = INF) {
function getRowsFromTable($array, $colName, mixed $colValues, $strict = true, $count = INF) {
$found = [];
$nFound = 0;
$colValues = (array)$colValues;
Expand All @@ -398,7 +398,7 @@ function getRowsFromTable($array, $colName, $colValues, $strict = true, $count =
*
* @return array Строка, для которой в заданном столбце ячейка имеет заданное значение, либо пустой массив в случае, если ничего не найдено.
*/
function getRowFromTable($array, $colName, $colValues, $strict = true) {
function getRowFromTable($array, $colName, mixed $colValues, $strict = true) {
$found = getRowsFromTable($array, $colName, $colValues, $strict, 1);
count($found) && $found = reset($found);
return $found;
Expand Down
71 changes: 7 additions & 64 deletions lib/Common/functions.compatibility.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (! function_exists('mb_strcasecmp')) {

$encoding = mb_internal_encoding();
}
return strcmp(mb_strtoupper($str1, $encoding), mb_strtoupper($str2, $encoding));
return strcmp(mb_strtoupper((string) $str1, $encoding), mb_strtoupper((string) $str2, $encoding));
}
}

Expand All @@ -33,79 +33,22 @@ if (! function_exists('mb_strtr')) {

if (! function_exists('mb_str_pad')) {
function mb_str_pad($input, $pad_length, $pad_string=' ', $pad_type=STR_PAD_RIGHT) {
$diff = strlen($input) - mb_strlen($input);
return str_pad($input, $pad_length+$diff, $pad_string, $pad_type);
$diff = strlen((string) $input) - mb_strlen((string) $input);
return str_pad((string) $input, $pad_length+$diff, $pad_string, $pad_type);
}
}

if (! function_exists('mb_ucfirst')) {
function mb_ucfirst($string) {
$l = mb_substr($string, 0, 1);
$l = mb_substr((string) $string, 0, 1);
$l = mb_strtoupper($l);
return $l.mb_substr($string, 1);
return $l.mb_substr((string) $string, 1);
}
}
if (! function_exists('mb_lcfirst')) {
function mb_lcfirst($string) {
$l = mb_substr($string, 0, 1);
$l = mb_substr((string) $string, 0, 1);
$l = mb_strtolower($l);
return $l.mb_substr($string, 1);
}
}

// mbstring compatibility layer
if (! defined('MB_OVERLOAD_STRING')) {
define('MB_DISABLED', true);

function mb_substr() {
$a = func_get_args();
return call_user_func_array('substr', $a);
}

function mb_strpos() {
$a = func_get_args();
return call_user_func_array('strpos', $a);
}

function mb_stripos() {
$a = func_get_args();
return call_user_func_array('stripos', $a);
}

function mb_strrpos() {
$a = func_get_args();
return call_user_func_array('strrpos', $a);
}

function mb_strlen() {
$a = func_get_args();
$a = array_slice($a, 0, 1);
return call_user_func_array('strlen', $a);
}

function mb_strtoupper() {
$a = func_get_args();
$a = array_slice($a, 0, 1);
return call_user_func_array('strtoupper', $a);
}

function mb_strtolower() {
$a = func_get_args();
$a = array_slice($a, 0, 1);
return call_user_func_array('strtolower', $a);
}

function mb_strstr() {
$a = func_get_args();
return call_user_func_array('strstr', $a);
}

function mb_stristr() {
$a = func_get_args();
return call_user_func_array('stristr', $a);
}

function mb_parse_str($str, &$arr = null) {
return parse_str($str, $arr);
return $l.mb_substr((string) $string, 1);
}
}
Loading

0 comments on commit ee93907

Please sign in to comment.