diff --git a/DataStorage/Cache/Connection/FileCache.php b/DataStorage/Cache/Connection/FileCache.php
index 87c5f8135..0f79f17ec 100644
--- a/DataStorage/Cache/Connection/FileCache.php
+++ b/DataStorage/Cache/Connection/FileCache.php
@@ -231,7 +231,7 @@ final class FileCache extends ConnectionAbstract
} elseif ($type === CacheValueType::_ARRAY) {
return (string) \json_encode($value);
} elseif ($type === CacheValueType::_SERIALIZABLE) {
- return \get_class($value) . self::DELIM . $value->serialize();
+ return \get_class($value) . self::DELIM . $value->__serialize();
} elseif ($type === CacheValueType::_JSONSERIALIZABLE) {
return \get_class($value) . self::DELIM . ((string) \json_encode($value->jsonSerialize()));
} elseif ($type === CacheValueType::_NULL) {
@@ -351,7 +351,7 @@ final class FileCache extends ConnectionAbstract
}
$obj = new $namespace();
- $obj->unserialize(\substr($raw, $namespaceEnd + 1));
+ $obj->__unserialize(\substr($raw, $namespaceEnd + 1));
return $obj;
default:
diff --git a/DataStorage/Cache/Connection/MemCached.php b/DataStorage/Cache/Connection/MemCached.php
index 17f3e8a70..42279ca8e 100644
--- a/DataStorage/Cache/Connection/MemCached.php
+++ b/DataStorage/Cache/Connection/MemCached.php
@@ -245,7 +245,7 @@ final class MemCached extends ConnectionAbstract
}
$obj = new $namespace();
- $obj->unserialize(\substr($raw, $namespaceEnd + 1));
+ $obj->__unserialize(\substr($raw, $namespaceEnd + 1));
return $obj;
default:
diff --git a/DataStorage/Cache/Connection/RedisCache.php b/DataStorage/Cache/Connection/RedisCache.php
index c3d715403..61e3c818b 100644
--- a/DataStorage/Cache/Connection/RedisCache.php
+++ b/DataStorage/Cache/Connection/RedisCache.php
@@ -418,7 +418,7 @@ final class RedisCache extends ConnectionAbstract
} elseif ($type === CacheValueType::_ARRAY) {
return (string) \json_encode($value);
} elseif ($type === CacheValueType::_SERIALIZABLE) {
- return \get_class($value) . self::DELIM . $value->serialize();
+ return \get_class($value) . self::DELIM . $value->__serialize();
} elseif ($type === CacheValueType::_JSONSERIALIZABLE) {
return \get_class($value) . self::DELIM . ((string) \json_encode($value->jsonSerialize()));
} elseif ($type === CacheValueType::_NULL) {
@@ -475,7 +475,7 @@ final class RedisCache extends ConnectionAbstract
}
$obj = new $namespace();
- $obj->unserialize(\substr($raw, $namespaceEnd + 1));
+ $obj->__unserialize(\substr($raw, $namespaceEnd + 1));
return $obj;
default:
diff --git a/DataStorage/Database/Mapper/DataMapperAbstract.php b/DataStorage/Database/Mapper/DataMapperAbstract.php
index a884a17f8..6b01efd2f 100644
--- a/DataStorage/Database/Mapper/DataMapperAbstract.php
+++ b/DataStorage/Database/Mapper/DataMapperAbstract.php
@@ -355,7 +355,7 @@ abstract class DataMapperAbstract
} elseif ($type === 'Json') {
return (string) \json_encode($value);
} elseif ($type === 'Serializable') {
- return $value->serialize();
+ return $value->__serialize();
} elseif (\is_object($value) && \method_exists($value, 'getId')) {
return $value->getId();
}
diff --git a/DataStorage/Database/Mapper/ReadMapper.php b/DataStorage/Database/Mapper/ReadMapper.php
index b09e5e4df..fc7c02d6a 100644
--- a/DataStorage/Database/Mapper/ReadMapper.php
+++ b/DataStorage/Database/Mapper/ReadMapper.php
@@ -632,7 +632,7 @@ final class ReadMapper extends DataMapperAbstract
if ($member === null || $value === null) {
$obj->{$def['internal']} = $value;
} else {
- $member->unserialize($value);
+ $member->__unserialize($value);
}
}
@@ -706,7 +706,7 @@ final class ReadMapper extends DataMapperAbstract
$refProp->setValue($obj, \json_decode($value, true));
} elseif ($def['mapper']::COLUMNS[$column]['type'] === 'Serializable') {
$member = $isPublic ? $obj->{$member} : $refProp->getValue($obj);
- $member->unserialize($value);
+ $member->__unserialize($value);
}
if (!$isPublic) {
diff --git a/Message/Socket/SocketHeader.php b/Message/Socket/SocketHeader.php
index a858f6bf9..6159f817b 100644
--- a/Message/Socket/SocketHeader.php
+++ b/Message/Socket/SocketHeader.php
@@ -199,9 +199,9 @@ class SocketHeader extends HeaderAbstract
*
* @since 1.0.0
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return [];
+ return '';
}
/**
diff --git a/Model/Message/Dom.php b/Model/Message/Dom.php
index d7a774f96..4a0ea9ef4 100644
--- a/Model/Message/Dom.php
+++ b/Model/Message/Dom.php
@@ -125,13 +125,13 @@ final class Dom implements ArrayableInterface
/**
* Render message.
*
- * @return array
+ * @return string
*
* @since 1.0.0
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return $this->toArray();
+ return \json_encode($this->toArray());
}
/**
diff --git a/Model/Message/FormValidation.php b/Model/Message/FormValidation.php
index e695be6c4..faf442460 100644
--- a/Model/Message/FormValidation.php
+++ b/Model/Message/FormValidation.php
@@ -57,13 +57,13 @@ final class FormValidation implements \JsonSerializable, ArrayableInterface
/**
* Render message.
*
- * @return array
+ * @return string
*
* @since 1.0.0
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return $this->toArray();
+ return \json_encode($this->toArray());
}
/**
diff --git a/Model/Message/Notify.php b/Model/Message/Notify.php
index 1b40e0317..e097bbb5a 100644
--- a/Model/Message/Notify.php
+++ b/Model/Message/Notify.php
@@ -161,13 +161,13 @@ final class Notify implements \JsonSerializable, ArrayableInterface
/**
* Render message.
*
- * @return array
+ * @return string
*
* @since 1.0.0
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return $this->toArray();
+ return \json_encode($this->toArray());
}
/**
diff --git a/Model/Message/Redirect.php b/Model/Message/Redirect.php
index 7e19447fd..c1fe7c339 100644
--- a/Model/Message/Redirect.php
+++ b/Model/Message/Redirect.php
@@ -103,13 +103,13 @@ final class Redirect implements \JsonSerializable, ArrayableInterface
/**
* Render message.
*
- * @return array
+ * @return string
*
* @since 1.0.0
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return $this->toArray();
+ return \json_encode($this->toArray());
}
/**
diff --git a/Model/Message/Reload.php b/Model/Message/Reload.php
index c2f362c52..04e0c1096 100644
--- a/Model/Message/Reload.php
+++ b/Model/Message/Reload.php
@@ -71,13 +71,13 @@ final class Reload implements \JsonSerializable, ArrayableInterface
/**
* Render message.
*
- * @return array
+ * @return string
*
* @since 1.0.0
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return $this->toArray();
+ return \json_encode($this->toArray());
}
/**
diff --git a/Stdlib/Base/FloatInt.php b/Stdlib/Base/FloatInt.php
index 1f8a5e123..a5728a72f 100644
--- a/Stdlib/Base/FloatInt.php
+++ b/Stdlib/Base/FloatInt.php
@@ -306,9 +306,9 @@ class FloatInt
*
* @since 1.0.0
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return [$this->getInt()];
+ return (string) $this->getInt();
}
/**
diff --git a/Stdlib/Base/Iban.php b/Stdlib/Base/Iban.php
index 49e79256e..815e2ee48 100644
--- a/Stdlib/Base/Iban.php
+++ b/Stdlib/Base/Iban.php
@@ -254,9 +254,9 @@ class Iban
/**
* {@inheritdoc}
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return [$this->prettyPrint()];
+ return $this->prettyPrint();
}
/**
diff --git a/Stdlib/Base/Location.php b/Stdlib/Base/Location.php
index e20b7898c..a9880d5bd 100644
--- a/Stdlib/Base/Location.php
+++ b/Stdlib/Base/Location.php
@@ -183,9 +183,9 @@ class Location implements \JsonSerializable
/**
* {@inheritdoc}
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return $this->toArray();
+ return \json_encode($this->toArray());
}
/**
diff --git a/Stdlib/Queue/PriorityQueue.php b/Stdlib/Queue/PriorityQueue.php
index 6f97f8743..beb8cf760 100644
--- a/Stdlib/Queue/PriorityQueue.php
+++ b/Stdlib/Queue/PriorityQueue.php
@@ -313,9 +313,9 @@ class PriorityQueue implements \Countable
/**
* {@inheritdoc}
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return $this->queue;
+ return \json_encode($this->queue);
}
/**
diff --git a/Utils/TaskSchedule/Interval.php b/Utils/TaskSchedule/Interval.php
index 548c0bfef..32fae1026 100644
--- a/Utils/TaskSchedule/Interval.php
+++ b/Utils/TaskSchedule/Interval.php
@@ -113,7 +113,7 @@ class Interval
$this->start = $start ?? new \DateTime('now');
if ($interval !== null) {
- $this->unserialize($interval);
+ $this->__unserialize($interval);
}
}
@@ -520,13 +520,13 @@ class Interval
/**
* Create string representation.
*
- * @return array
+ * @return string
*
* @since 1.0.0
*/
- public function __serialize() : array
+ public function __serialize() : string
{
- return [
+ return \json_encode([
'start' => $this->start->format('Y-m-d H:i:s'),
'end' => $this->end === null ? null : $this->end->format('Y-m-d H:i:s'),
'maxDuration' => $this->maxDuration,
@@ -535,7 +535,7 @@ class Interval
'dayOfMonth' => $this->dayOfMonth,
'dayOfWeek' => $this->dayOfWeek,
'year' => $this->year,
- ];
+ ]);
}
/**
diff --git a/tests/Localization/MoneyTest.php b/tests/Localization/MoneyTest.php
index 04656ae6d..420048ed7 100644
--- a/tests/Localization/MoneyTest.php
+++ b/tests/Localization/MoneyTest.php
@@ -102,7 +102,7 @@ final class MoneyTest extends \PHPUnit\Framework\TestCase
public function testMoneySerialization() : void
{
$money = new Money('999.23');
- self::assertEquals(9992300, $money->serialize());
+ self::assertEquals(9992300, $money->__serialize());
}
/**
@@ -112,7 +112,7 @@ final class MoneyTest extends \PHPUnit\Framework\TestCase
public function testMoneyUnserialization() : void
{
$money = new Money('999.23');
- $money->unserialize(3331234);
+ $money->__unserialize(3331234);
self::assertEquals('333.12', $money->getAmount());
}
diff --git a/tests/Model/Message/DomTest.php b/tests/Model/Message/DomTest.php
index a1deb7cb8..6b2748809 100644
--- a/tests/Model/Message/DomTest.php
+++ b/tests/Model/Message/DomTest.php
@@ -79,7 +79,7 @@ final class DomTest extends \PHPUnit\Framework\TestCase
'selector' => '#sel',
'action' => DomAction::SHOW,
'content' => 'msg',
- ]), $obj->serialize());
+ ]), $obj->__serialize());
self::assertEquals([
'type' => 'dom',
@@ -90,7 +90,7 @@ final class DomTest extends \PHPUnit\Framework\TestCase
], $obj->jsonSerialize());
$obj2 = new Dom();
- $obj2->unserialize($obj->serialize());
+ $obj2->__unserialize($obj->__serialize());
self::assertEquals($obj, $obj2);
}
}
diff --git a/tests/Model/Message/FormValidationTest.php b/tests/Model/Message/FormValidationTest.php
index 8de44bead..b95d2b381 100644
--- a/tests/Model/Message/FormValidationTest.php
+++ b/tests/Model/Message/FormValidationTest.php
@@ -56,11 +56,11 @@ final class FormValidationTest extends \PHPUnit\Framework\TestCase
$obj = new FormValidation($arr);
self::assertEquals(['type' => 'validation', 'validation' => $arr], $obj->toArray());
- self::assertEquals(\json_encode(['type' => 'validation', 'validation' => $arr]), $obj->serialize());
+ self::assertEquals(\json_encode(['type' => 'validation', 'validation' => $arr]), $obj->__serialize());
self::assertEquals(['type' => 'validation', 'validation' => $arr], $obj->jsonSerialize());
$obj2 = new FormValidation();
- $obj2->unserialize($obj->serialize());
+ $obj2->__unserialize($obj->__serialize());
self::assertEquals($obj, $obj2);
}
}
diff --git a/tests/Model/Message/NotifyTest.php b/tests/Model/Message/NotifyTest.php
index 3f18c9d5c..35ecbded6 100644
--- a/tests/Model/Message/NotifyTest.php
+++ b/tests/Model/Message/NotifyTest.php
@@ -84,7 +84,7 @@ final class NotifyTest extends \PHPUnit\Framework\TestCase
'msg' => 'msg',
'title' => 'title',
'level' => NotifyType::ERROR,
- ]), $obj->serialize());
+ ]), $obj->__serialize());
self::assertEquals([
'type' => 'notify',
@@ -96,7 +96,7 @@ final class NotifyTest extends \PHPUnit\Framework\TestCase
], $obj->jsonSerialize());
$obj2 = new Notify();
- $obj2->unserialize($obj->serialize());
+ $obj2->__unserialize($obj->__serialize());
self::assertEquals($obj, $obj2);
}
}
diff --git a/tests/Model/Message/RedirectTest.php b/tests/Model/Message/RedirectTest.php
index 343b71281..076be4c13 100644
--- a/tests/Model/Message/RedirectTest.php
+++ b/tests/Model/Message/RedirectTest.php
@@ -59,7 +59,7 @@ final class RedirectTest extends \PHPUnit\Framework\TestCase
$obj = new Redirect('url', true);
self::assertEquals(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true], $obj->toArray());
- self::assertEquals(\json_encode(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true]), $obj->serialize());
+ self::assertEquals(\json_encode(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true]), $obj->__serialize());
self::assertEquals(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true], $obj->jsonSerialize());
$obj->setDelay(6);
@@ -67,7 +67,7 @@ final class RedirectTest extends \PHPUnit\Framework\TestCase
self::assertEquals(['type' => 'redirect', 'time' => 6, 'uri' => 'test', 'new' => true], $obj->toArray());
$obj2 = new Redirect();
- $obj2->unserialize($obj->serialize());
+ $obj2->__unserialize($obj->__serialize());
self::assertEquals($obj, $obj2);
}
}
diff --git a/tests/Model/Message/ReloadTest.php b/tests/Model/Message/ReloadTest.php
index 6ceef1886..5691e234d 100644
--- a/tests/Model/Message/ReloadTest.php
+++ b/tests/Model/Message/ReloadTest.php
@@ -55,14 +55,14 @@ final class ReloadTest extends \PHPUnit\Framework\TestCase
$obj = new Reload(5);
self::assertEquals(['type' => 'reload', 'time' => 5], $obj->toArray());
- self::assertEquals(\json_encode(['type' => 'reload', 'time' => 5]), $obj->serialize());
+ self::assertEquals(\json_encode(['type' => 'reload', 'time' => 5]), $obj->__serialize());
self::assertEquals(['type' => 'reload', 'time' => 5], $obj->jsonSerialize());
$obj->setDelay(6);
self::assertEquals(['type' => 'reload', 'time' => 6], $obj->toArray());
$obj2 = new Reload();
- $obj2->unserialize($obj->serialize());
+ $obj2->__unserialize($obj->__serialize());
self::assertEquals($obj, $obj2);
}
}
diff --git a/tests/Stdlib/Base/IbanTest.php b/tests/Stdlib/Base/IbanTest.php
index bfae19a1d..e732f6bf8 100644
--- a/tests/Stdlib/Base/IbanTest.php
+++ b/tests/Stdlib/Base/IbanTest.php
@@ -60,10 +60,10 @@ final class IbanTest extends \PHPUnit\Framework\TestCase
$iban = new Iban($strRepresentation);
self::assertEquals($strRepresentation, $iban->prettyPrint());
- self::assertEquals($strRepresentation, $iban->serialize());
+ self::assertEquals($strRepresentation, $iban->__serialize());
- $iban->unserialize('dE226008000009600280 00');
- self::assertEquals('DE22 6008 0000 0960 0280 00', $iban->serialize());
+ $iban->__unserialize('dE226008000009600280 00');
+ self::assertEquals('DE22 6008 0000 0960 0280 00', $iban->__serialize());
}
/**
diff --git a/tests/Stdlib/Base/LocationTest.php b/tests/Stdlib/Base/LocationTest.php
index 8a95ea7d8..3ba82819d 100644
--- a/tests/Stdlib/Base/LocationTest.php
+++ b/tests/Stdlib/Base/LocationTest.php
@@ -215,7 +215,7 @@ final class LocationTest extends \PHPUnit\Framework\TestCase
$this->location->setGeo(['lat' => 12.1, 'long' => 11.2,]);
self::assertEquals($expected, $this->location->jsonSerialize());
- self::assertEquals(\json_encode($this->location->jsonSerialize()), $this->location->serialize());
+ self::assertEquals(\json_encode($this->location->jsonSerialize()), $this->location->__serialize());
}
/**
@@ -237,7 +237,7 @@ final class LocationTest extends \PHPUnit\Framework\TestCase
],
];
- $this->location->unserialize(\json_encode($expected));
- self::assertEquals(\json_encode($expected), $this->location->serialize());
+ $this->location->__unserialize(\json_encode($expected));
+ self::assertEquals(\json_encode($expected), $this->location->__serialize());
}
}
diff --git a/tests/Stdlib/Queue/PriorityQueueTest.php b/tests/Stdlib/Queue/PriorityQueueTest.php
index 1c9c6dce5..615a2c3df 100644
--- a/tests/Stdlib/Queue/PriorityQueueTest.php
+++ b/tests/Stdlib/Queue/PriorityQueueTest.php
@@ -187,9 +187,9 @@ final class PriorityQueueTest extends \PHPUnit\Framework\TestCase
$queue->insert('c', -1);
$queue2 = new PriorityQueue();
- $queue2->unserialize($queue->serialize());
+ $queue2->__unserialize($queue->__serialize());
- self::assertEquals($queue->serialize(), $queue2->serialize());
+ self::assertEquals($queue->__serialize(), $queue2->__serialize());
}
/**
diff --git a/tests/Utils/TaskSchedule/IntervalTest.php b/tests/Utils/TaskSchedule/IntervalTest.php
index 6740b2dba..3528d7ea3 100644
--- a/tests/Utils/TaskSchedule/IntervalTest.php
+++ b/tests/Utils/TaskSchedule/IntervalTest.php
@@ -51,7 +51,7 @@ final class IntervalTest extends \PHPUnit\Framework\TestCase
'dayOfMonth' => [],
'dayOfWeek' => [],
'year' => [],
- ]), $interval->serialize()
+ ]), $interval->__serialize()
);
}
@@ -307,7 +307,7 @@ final class IntervalTest extends \PHPUnit\Framework\TestCase
'dayOfMonth' => [['start' => 1, 'end' => 3, 'step' => 2]],
'dayOfWeek' => [['start' => 1, 'end' => 3, 'step' => 2]],
'year' => [['start' => 1, 'end' => 3, 'step' => 2]],
- ]), $interval->serialize());
+ ]), $interval->__serialize());
}
/**
@@ -327,7 +327,7 @@ final class IntervalTest extends \PHPUnit\Framework\TestCase
$interval->addDayOfMonth(1, 3, 2);
$interval->addDayOfWeek(1, 3, 2);
- $interval2 = new Interval(null, $interval->serialize());
+ $interval2 = new Interval(null, $interval->__serialize());
self::assertEquals('2015-08-14', $interval2->getStart()->format('Y-m-d'));
self::assertEquals('2018-10-30', $interval2->getEnd()->format('Y-m-d'));
diff --git a/tests/Views/ViewTest.php b/tests/Views/ViewTest.php
index 5f46d2994..306fd2155 100644
--- a/tests/Views/ViewTest.php
+++ b/tests/Views/ViewTest.php
@@ -410,10 +410,10 @@ final class ViewTest extends \PHPUnit\Framework\TestCase
public function testSerialize() : void
{
$view = new View();
- self::assertEquals('[]', $view->serialize());
+ self::assertEquals('[]', $view->__serialize());
$view->setTemplate('/phpOMS/tests/Views/testTemplate');
- self::assertEquals('Test', $view->serialize());
+ self::assertEquals('Test', $view->__serialize());
}
/**
@@ -476,7 +476,7 @@ final class ViewTest extends \PHPUnit\Framework\TestCase
$view = new View($this->app->l11nManager);
$view->setTemplate('something.txt');
- self::assertEquals('', $view->serialize());
+ self::assertEquals('', $view->__serialize());
}
/**