Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
serializedfield.php
1<?php
3
8
13{
14 public function tryUnpack()
15 {
16 $result = new Main\Result();
17 if (!unserialize($this->packedValue, ['allowed_classes' => false]))
18 {
19 $result->addError(new Main\Error('Unavailable value for unpacking'));
20 }
21 return $result;
22 }
23
24 public function unpack()
25 {
26 $value = unserialize($this->packedValue, ['allowed_classes' => [
27 \Bitrix\Main\Type\DateTime::class,
28 \Bitrix\Main\Type\Date::class,
29 \DateTime::class,
30 \DateTimeZone::class,
31 ]]);
32
33 if (!$value)
34 {
35 return null;
36 }
37
38 return $value;
39 }
40}