Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Updated Serializer implementations #8382

Merged
merged 2 commits into from
Dec 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/guides/v2.3/extension-dev-guide/framework/serializer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -129,4 +139,4 @@ Here is an example:
}
...

```
```