diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-22 17:47:16 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-03-22 10:43:06 +0100 |
commit | d373c11e710b525feb6373629e3d1ebffef2dd5b (patch) | |
tree | 754e1cef72cda4507a688dd609b42fa952638cd5 /UPGRADING | |
parent | e7e2056d1a993a01c9d57fb2261066855d282d8f (diff) | |
download | php-git-d373c11e710b525feb6373629e3d1ebffef2dd5b.tar.gz |
Implement new custom object serialization mechanism
RFC: https://wiki.php.net/rfc/custom_object_serialization
Diffstat (limited to 'UPGRADING')
-rw-r--r-- | UPGRADING | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -107,6 +107,7 @@ PHP 7.4 UPGRADE NOTES This will enforce that $user->id can only be assigned integer and $user->name can only be assigned strings. For more information see the RFC: https://wiki.php.net/rfc/typed_properties_v2 + . Added support for coalesce assign (??=) operator. For example: $array['key'] ??= computeDefault(); @@ -156,6 +157,20 @@ PHP 7.4 UPGRADE NOTES . strip_tags() now also accepts an array of allowed tags: Instead of strip_tags($str, '<a><p>') you can now write strip_tags($str, ['a', 'p']). + . A new mechanism for custom object serialization has been added, which + uses two new magic methods: + + // Returns array containing all the necessary state of the object. + public function __serialize(): array; + + // Restores the object state from the given data array. + public function __unserialize(array $data): void; + + The new serialization mechanism supersedes the Serializable interface, + which will be deprecated in the future. + + RFC: https://wiki.php.net/rfc/custom_object_serialization + ======================================== 3. Changes in SAPI modules ======================================== |