function SqlContentEntityStorage::handleNullableFieldUnserialize

Handles NULL values before passing data to unserialize().

Parameters

mixed|null $value: The serialized value.

Return value

mixed|null The unserialized data, or NULL if the original value is NULL.

3 calls to SqlContentEntityStorage::handleNullableFieldUnserialize()
SqlContentEntityStorage::loadFromDedicatedTables in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Loads values of fields stored in dedicated tables for a group of entities.
SqlContentEntityStorage::loadFromSharedTables in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Loads values for fields stored in the shared data tables.
SqlContentEntityStorage::mapFromStorageRecords in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Maps from storage records to entity objects, and attaches fields.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 1798

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

protected function handleNullableFieldUnserialize(mixed $value) : mixed {
  // Ensure NULL values aren't passed to unserialize().
  if ($value === NULL) {
    return NULL;
  }
  return unserialize($value);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.