Skip to content

Commit

Permalink
monolog updated (#10)
Browse files Browse the repository at this point in the history
* monolog updated

* deprecated code deleted

---------

Co-authored-by: Yury Bushenko <yury.bushenko@dalee.ru>
  • Loading branch information
Nastro and Yury Bushenko authored Oct 30, 2023
1 parent b2ef252 commit 3e45002
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## [3.0.2] 2023-10-30
- Обновлена мажорная версия monolog/monolog до ^3.0 lock = `3.5.0`
- Исправлена ошибка в PXStorageTypeSerialized при использовании некорректного json

## [3.0.1] 2023-10-16
- Исправлена ошибка в Filesys/dir
- Исправлены ошибки в Smarty при обращении к несуществующим переменным в шаблоне
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"require": {
"php": "^8.2",
"dalee/pp-installers": "~1.0.5",
"monolog/monolog": "^1.19",
"monolog/monolog": "^3.0",
"symfony/http-foundation": "^6.0",
"ramsey/uuid": "^3.5",
"symfony/console": "^6.0",
Expand Down
23 changes: 2 additions & 21 deletions lib/StorageType/serialized.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,8 @@ class PXStorageTypeSerialized extends PXStorageType
$v = null;

// skip empties and nulls
if ($w && $w !== 'null' && $w !== 'N;') {

// the first byte can be one of [b, i, d, s, a, O, C, N, r, R].
// the second byte can be one of [:, ;].
// see http://www.phpinternalsbook.com/classes_objects/serialization.html
// but json more simpler to check so we will do it.
$fb = $w[0];
$sb = $w[1];
$lb = substr((string) $w, -1); // last byte

// json_encoded data. not hardened check
$json = ctype_digit((string) $fb) || (!ctype_alpha((string) $fb) && !ctype_alpha((string) $fb));
// null equals 'N;', all other /^\w:.*;$/
$srlz = ctype_alpha((string) $fb) && $sb === ':' && ($lb === ';' || $lb === '}');

if ($srlz) {
$v = @unserialize($w);
} elseif ($json) {
$v = json_decode((string) $w, true, 512, JSON_THROW_ON_ERROR);
}

if ($w && $w !== 'null') {
$v = json_decode((string) $w, true);
}

return $v;
Expand Down
2 changes: 1 addition & 1 deletion lib/common.version.inc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

define('PP_VERSION', 'v3.0.1');
define('PP_VERSION', 'v3.0.2');

0 comments on commit 3e45002

Please sign in to comment.