From d0573b97bd067661b228f257326bd9bda2f4e448 Mon Sep 17 00:00:00 2001 From: Adarsh Manickam Date: Mon, 14 Dec 2020 17:01:55 +0530 Subject: [PATCH] Updated Serializer implementations --- .../extension-dev-guide/framework/serializer.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/guides/v2.3/extension-dev-guide/framework/serializer.md b/src/guides/v2.3/extension-dev-guide/framework/serializer.md index b11ecf55de5..93cd922c8fa 100644 --- a/src/guides/v2.3/extension-dev-guide/framework/serializer.md +++ b/src/guides/v2.3/extension-dev-guide/framework/serializer.md @@ -26,12 +26,22 @@ For security reasons, `SerializerInterface` implementations, such as the Json an ### Json (default) The [`Magento\Framework\Serialize\Serializer\Json`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Serialize/Serializer/Json.php){:target="_blank"} class serializes and unserializes data using the [JSON](http://www.json.org/){:target="_blank"} format. -This class does not unserialize objects. + +### JsonHexTag + +The [`Magento\Framework\Serialize\Serializer\JsonHexTag`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Serialize/Serializer/JsonHexTag.php){:target="_blank"} class serializes and unserializes data using the [JSON](http://www.json.org/){:target="_blank"} format using the `JSON_HEX_TAG` option enabled. + +### Base64Json + +The [`Magento\Framework\Serialize\Serializer\Base64Json`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Serialize/Serializer/Base64Json.php){:target="_blank"} class serializes and encodes in the base64 format, and decodes the base64 encoded string and unserializes data using the [JSON](http://www.json.org/){:target="_blank"} format. ### Serialize The [`Magento\Framework\Serialize\Serializer\Serialize`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php){:target="_blank"} class is less secure than the Json implementation but provides better performance on large arrays. -This class does not unserialize objects in [PHP](https://glossary.magento.com/php) 7. + +### FormData + +The [`Magento\Framework\Serialize\Serializer\FormData`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Serialize/Serializer/FormData.php){:target="_blank"} class unserializes the form data using the [JSON](http://www.json.org/){:target="_blank"} format. This class does not serialize objects to a form data format. {:.bs-callout-warning} Magento discourages using the Serialize implementation directly because it can lead to security vulnerabilities. Always use the `SerializerInterface` for serializing and unserializing. @@ -129,4 +139,4 @@ Here is an example: } ... -``` \ No newline at end of file +```