[PHP 8.1] Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords()

Created on 30 November 2022, almost 2 years ago
Updated 22 March 2023, over 1 year ago

Problem/Motivation

On PHP 8.1, when loading a profile programmatically, where the profile's revision data column has a NULL (default) value, the following PHP warning is shown:

Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords()

Steps to reproduce

Load a profile entity where the profile's revision data column has a NULL (default) value, e.g.:

$profile = \Drupal::EntityTypeManager()
    ->getStorage('profile')
    ->loadByUser($user, 'main');

Proposed resolution

Not entirely sure. Should the default value of the data column in the profile_revision table not be NULL?

Remaining tasks

Figure out solution, write patch.

API changes

Data model changes

📌 Task
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇨🇦Canada brunodbo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024