Problem/Motivation

Fields may have serialized columns that can be NULL if they are not required. A good example from Drupal Core is the Link field which has a nullable options column. SqlContentEntityStorage automatically tries to unserialize these columns. If the value is NULL, then the following deprecation warning is issued:

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

This probably doesn't happen during normal editorial workflows. In the wild NULL values have resulted from migrations and something to do with translatable Paragraphs. See #2871217: Handle NULL URL options in LinkFormatter::buildUrl().

Also note that this has nothing to do with serialized NULL values. This is about empty columns.

Steps to reproduce

  1. Add a Link field to any node type.
  2. Create a new node of that type. Put any sample values you want in the Link field.
  3. Manually edit the site's database and update the Link field's options column to set the value to NULL.
  4. (optional?) Rebuild the cache.
  5. View the node. Note that the site will crash with a WSoD due to #2871217, but that's a separate issue.
  6. Check the site's recent log messages. Look for an entry with the error shown above.

Proposed resolution

Introduce a utility method called handleNullableFieldUnserialize() to replace the current usages of unserialize() in SqlContentEntityStorage. handleNullableFieldUnserialize() should return NULL if the passed value is NULL.

Remaining tasks

Review. Feedback. Commit.

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3300404

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

eduardo morales alberti’s picture

Status: Active » Needs review
taras.suliatitskiy’s picture

StatusFileSize
new3.58 KB

Patch for drupal version 9.3.19

daffie’s picture

Component: database system » entity system
albeorte’s picture

Status: Needs review » Reviewed & tested by the community

The change looks good to me, and seems to fix the issue.
Applied in D9.4

avpaderno’s picture

Title: Deprecated function: unserialize() SqlContentEntityStorage PHP 8.1 » unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromSharedTables()
Issue tags: +PHP 8.1
alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs steps to reproduce

The steps to reproduce in the issue summary are not accurate. We are currently testing Drupal core on PHP 8.1 and this does not occur. This error is likely something else that is wrong and it would be great to understand what that is rather that doing unnecessary string casts everywhere.

p-neyens made their first commit to this issue’s fork.

bramdriesen’s picture

Status: Needs work » Needs review

Set proper status

daffie’s picture

Status: Needs review » Needs work

Comment #8 from @alexpott has not been addressed.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

brunodbo’s picture

Title: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromSharedTables() » [PHP 8.1] Unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromSharedTables()

I'm seeing a similar warning when programmatically loading a profile, when the data column for a profile's record in the profile_revision table is NULL:

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

See #3324465: [PHP 8.1] Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords() for more details (I filed a bug report for Profile module, but not sure if that was the right place).

The patch in #4 fixes the warning.

avpaderno’s picture

Title: [PHP 8.1] Unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromSharedTables() » Unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromSharedTables()
akoe’s picture

StatusFileSize
new60.65 KB

It seems the deprecation warning occurs when $row[$column_name] is null which can be the case for any null-able table columns related to fields that are tried to be loaded here.
In the attached xdebug screenshot the columns link_override__uri, link_override__title and link_override__options trigger the warning.
The handled columns are provided by TableMapping->getColumnNames(). This method provides all column names, so i guess a check for empty ones could be necessary.
Xdebug-screenshot

akoe’s picture

Just updated the branch on the related issue fork. @p-neyen's solution maked sense to me and applied it to the method SqlContentEntityStorage->loadFromSharedTables()
Also @alexpott's concerns are addressed there.

metallized’s picture

Status: Needs work » Needs review

It seems legit to me, updated status.

metallized’s picture

Status: Needs review » Needs work

Sorry for the bad status update, i test against the last merge request and what was reported by @brunodbo at #13 is still happening.

Also the cast to string on unserialize function seems to works (#4).

wranvaud’s picture

This is happening on taxonomy terms with an empty description. It looks like checking for the value before unserializing is a good solution though I believe null coalescing operator is better than type casting because casting an array to string would output "Array" rather than throwing an error.

avpaderno’s picture

Status: Needs work » Needs review
holo96’s picture

Status: Needs review » Reviewed & tested by the community

#19 solves issue.

I am wondering if this issue is Normal priority?
This kind of makes drupal 9.5 & 10 incompatible with >php8.1, at least partially, no one wants warnings all over their website.

PHP 8.1 is recommended.

https://www.drupal.org/docs/system-requirements/php-requirements

holo96’s picture

And just want to add, 'map' field type from core is affected, I am not sure if it is used in core...
But commerce order uses it.

Basically all fields with serialized property are affected

quietone’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

Comment #8 points out that the core is tested on PHP 8.1 and this error is not occurring. In that comment steps to reproduce the problem were asked for and they have not been supplied.

@akoe, can you expand more on #16 where you said that alexpott's concerns are addressed?

This needs steps to reproduce so we can duplicate the problem manually and in a test.

I am setting this back for those steps to be added.

holo96’s picture

As mentioned in #13:

Steps to reproduce:
1. Create new entity type
2. Install newly added entity type
3. Create at least one entity (id: 1)
4. Add map base field to created entity type:

    $fields['data'] = BaseFieldDefinition::create('map')
      ->setLabel(t('Data'))
      ->setDescription(t('A serialized array of additional data.'));

5. load entity
6. Warning will occur

I've tried adding:

->setInitialValue([])

but it does not help

holo96’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs tests

This seems like we are fixing a symptom of a possible bigger issue.

But either way it will need a test case showing the issue.

holo96’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs steps to reproduce, -Needs tests
StatusFileSize
new1014 bytes

Here is failing test.

In case #19 patch is applied, test passes.

I've just updated existing test, I am not sure if we should create new test case for this issue?

holo96’s picture

Here is combined patch od #27 and #19

The last submitted patch, 27: 3300404-27-map-field-failing-php-81-test.patch, failed testing. View results

holo96’s picture

So #27 proves recreation of error...
And it is fixed in #28

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Will move this one on and see what the committers think.

quietone’s picture

Thanks for the steps to reproduce. I used code from the examples module to play with this and wasn't able to reproduce the error.

I do agree with #26 that this may be fixing the symptom and not the underlying problem. This also should have a better title, one that describes the action that the issue is fixing or improving.

holo96’s picture

Yes, something is wrong with initial value...
- In case new entity is added after field installation, value for map field is empty array "a:0:{}" (maybe we can change to that in default value?)
- Empty string does return false when unserialized but so does null and drupal 8 and 9 worked properly whole lifetime

So I guess either we use

$record->{$column_name} ?? '' ('a:0:{}')

Or we fix initial value and create update hook for populating values for backward compatibility.

Edit: also all fields are set to null when empty, so I think for consistency we should be able to set map fields to NULL

smulvih2’s picture

#28 seems to work for me on 9.5.5

rollins’s picture

Patch #28 resolved the issue, thank you DavorHorvacki!

catch’s picture

Status: Reviewed & tested by the community » Needs work

I think the root cause of this is probably related to #2346019: Handle initial values when creating a new field storage definition - maybe map item doesn't set an initial value in the field storage definition?

It could also be #2883851: Add initial values support for configurable and multi-valued fields though which is unresolved.

If we're able to fix this by setting an initial value, then I think we should. If it's due to #2883851: Add initial values support for configurable and multi-valued fields , then we should add a comment with a @todo to the places adding the null check.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

donquixote’s picture

So for us this happens with a custom base field of type 'link', that is set to be optional.

function mymodule_entity_base_field_info(EntityTypeInterface $entity_type) {
  [..]
  $fields['my_link_field'] = BaseFieldDefinition::create('link')
    ->setLabel(t('My custom link field'))
    ->setRequired(FALSE)
    // I suppose all the below is irrelevant.
    ->setTranslatable(TRUE)
    ->setRevisionable(TRUE)
    ->setSettings([
      'link_type' => LinkItemInterface::LINK_EXTERNAL,
      'title' => DRUPAL_DISABLED,
    ])
    ->setDisplayOptions('form', [
      'type' => 'link_default',
      'weight' => 0,
    ])
    ->setDisplayConfigurable('view', TRUE)
    ->setDisplayConfigurable('form', TRUE);
  [..]
  return $fields;
}

The base field adds three columns to `node_field_data` and `node_field_revision` tables:
- my_link_field__uri: varchar, allows NULL
- my_link_field__title: varchar, allows NULL
- my_link_field__options: serialized, allows NULL

Checking the database, I find a bunch of rows where `my_link_field__options` has the value NULL, and other rows where the value is `N;`.
The `changed` column shows that all those with value NULL are old, and those with value `N;` are newer.

So this means that, when the base field is added, the value for that column is initialized as NULL.
But when updating or creating content later, the column is initialized with `N;` (serialized NULL).

So the steps to reproduce would be:
- Create a node, while no custom base fields have been declared yet.
- Declare a custom base field in a module.
- Create another node.
- Load each node (separately), compare the output.
- Also check the database.

Observed behavior:
- Column is NULL for the old node, but 'N;' for the new node.
- Loading the old node produces a warning.

donquixote’s picture

@catch

If we're able to fix this by setting an initial value, then I think we should.

I think the initial value idea is incomplete at best.

If a database column allows NULL, then we should not allow this to cause a problem when loading the entity.

So we need to do one of two things:

  1. Not allow NULL for serialized columns from optional fields. Only allow 'N;'. This also means we need to set an initial value, and update old records.
  2. Check for NULL before calling unserialize(). This is what the patch in this issue does, and this is what restores pre-8.1 behavior.

Interestingly, `serialize(NULL)` returns FALSE instead of NULL. This is also the legacy behavior, and this is what the patch does.
However, we probably rather want NULL instead of FALSE.
To achieve that, we could use `unserialize($row[$column_name] ?? 'N;')` instead of `unserialize($row[$column_name] ?? '')`.

But we would need to investigate the side effects.

holo96’s picture

For map field type default value after field is installed is 'a:0:{}' not 'N;', but NULL could work anyway

hockey2112’s picture

The patch is #28 worked for me.

saganakat’s picture

The patch is #28 worked for me in drupal 9.5.9

megakeegman’s picture

Patch #28 also worked for me, in Drupal 9.5.4

holo96’s picture

StatusFileSize
new2.35 KB

Test only!

I've added link field to test and separated it to new test file.

I won't be working on this issue further because I still think #19 is easiest all around solution, backward compatible.

nagy.balint’s picture

Thanks!

#28 also works for me under 10.1.4

avpaderno’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

#44 appears to be a tests only patch that didn’t run. Could we get also a full patch

holo96’s picture

Status: Needs work » Needs review
StatusFileSize
new5.94 KB

Here is combined patch.

I'll move this to Needs review but #36 stays unresolved.

smustgrave’s picture

Status: Needs review » Needs work
kiwad’s picture

StatusFileSize
new15.5 KB
new8.61 KB

In case this helps

I had this specific

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

In my case, was related to Profile, maybe some update in the past didnt go through or is missing

Simply loading/saving the entity changed value of data from false to array and message disappeared

pgrandeg’s picture

#48 works perfect on d10.1.4 and PHP8.1

papagrande’s picture

For others' reference, a client had a link field that was triggering this error on six nodes. The status page had no errors about the field and the configuration status was clean.

Resaving the nodes didn't fix the problem. Nor did copying data via SQL from the field table to the revision table. Here's what did:

  1. Resave the field settings.
  2. Resave the field storage settings.
  3. Each node lost the link field data so copy and paste the link data from another server.

And after resaving the field, the configuration status still had no changes between database and file.

louis-cuny’s picture

krystalcode’s picture

I focused on mapFromStorageRecords since that was the error that I was encountering. In my case an old profile entity had the data column set to NULL in the database.

From #48:
$values[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT] = !empty($column['serialize']) ? unserialize($record->{$column_name} ?? '') : $record->{$column_name};

With this unserialize will return FALSE when passing an empty string. The entity field then ends up having a field item with value FALSE - which is wrong; the field item list should be empty.

I think the following would be better:

if (empty($column['serialize']) || isset($record->{$column_name})) {
  $values[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT] = !empty($column['serialize']) ? unserialize($record->{$column_name}) : $record->{$column_name};
}
else {
  $values[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT] = NULL;
}
socialnicheguru’s picture

@krystalcode could you updte patch so we can test.

In general is there a need to develop tests for this?

RoSk0 made their first commit to this issue’s fork.

rosk0’s picture

Status: Needs work » Needs review

Started new merge request targeting 11.x with:

  1. patch from #48
  2. suggestion from #54
  3. and links to #2883851: Add initial values support for configurable and multi-valued fields from #36
amanire’s picture

Good to see progress here! FWIW I just deployed the patch in #48 to a production site and it resolved the deprecation warnings described in https://www.drupal.org/project/profile/issues/3324465. I was a little surprised at the substantial CPU performance improvement for the site, presumably because these were invalidating the varnish cache.

holo96’s picture

Updating NULL values to either 'a:0:{}' (map field) or 'N;' (almost any other) on problematic column(s) once also resolves problem.
No patch needed. You can create update hook for this.

This works because problem is appearing only when you are adding field to entities with existing entries.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Part of IS appear to be missing. Thanks

jungle’s picture

Title: Unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromSharedTables() » Unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage
StatusFileSize
new4.6 KB

Per @krystalcode's comment in #54, I introduced a utility method to replace the current usages of unserialize() in SqlContentEntityStorage

+  /**
+   * Safely unserializes data.
+   *
+   * @param string|null $value
+   *   The serialized string.
+   *
+   * @return mixed|null
+   *   The unserialized data, or null if the data is invalid.
+   */
+  public static function safeUnserialize($value) {
+    // Return null if the value is an empty string or null.
+    if ($value === '' || $value === null) {
+      return null;
+    }
+
+    // Attempt to unserialize the value.
+    $result = @unserialize($value);
+
+    // Check if unserialize resulted in false, indicating failure.
+    // Also ensure the input value wasn't the serialized form of false itself.
+    if ($result === false && $value !== serialize(false)) {
+      return null;
+    }
+
+    // Return the unserialized result.
+    return $result;
+  }
+

NW for adding tests.

+++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
@@ -470,7 +470,7 @@ protected function mapFromStorageRecords(array $records, $load_from_revision = F
-              $values[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT][$property_name] = !empty($definition_columns[$property_name]['serialize']) ? unserialize($record->{$column_name}) : $record->{$column_name};
+              $values[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT][$property_name] = !empty($definition_columns[$property_name]['serialize']) ? SqlContentEntityStorage::safeUnserialize($record->{$column_name}) : $record->{$column_name};

@@ -481,7 +481,7 @@ protected function mapFromStorageRecords(array $records, $load_from_revision = F
-            $values[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT] = !empty($column['serialize']) ? unserialize($record->{$column_name}) : $record->{$column_name};
+            $values[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT] = !empty($column['serialize']) ? SqlContentEntityStorage::safeUnserialize($record->{$column_name}) : $record->{$column_name};

@@ -595,12 +595,12 @@ protected function loadFromSharedTables(array &$values, array &$translations, $l
-            $values[$id][$field_name][$langcode] = (!empty($column_attributes['serialize'])) ? unserialize($row[$column_name]) : $row[$column_name];
+            $values[$id][$field_name][$langcode] = (!empty($column_attributes['serialize'])) ? SqlContentEntityStorage::safeUnserialize($row[$column_name]) : $row[$column_name];
...
-              $values[$id][$field_name][$langcode][$property_name] = (!empty($column_attributes['serialize'])) ? unserialize($row[$column_name]) : $row[$column_name];
+              $values[$id][$field_name][$langcode][$property_name] = (!empty($column_attributes['serialize'])) ? SqlContentEntityStorage::safeUnserialize($row[$column_name]) : $row[$column_name];

@@ -1261,7 +1261,7 @@ protected function loadFromDedicatedTables(array &$values, $load_from_revision)
-              $item[$column] = (!empty($attributes['serialize'])) ? unserialize($row->$column_name) : $row->$column_name;
+              $item[$column] = (!empty($attributes['serialize'])) ? SqlContentEntityStorage::safeUnserialize($row->$column_name) : $row->$column_name;
jungle’s picture

Status: Needs work » Needs review
StatusFileSize
new9.46 KB

With tests added

smustgrave’s picture

Status: Needs review » Needs work

Thanks for working but would need to be an MR to test

Also was tagged issue summary update which still appears to be needed.

jungle changed the visibility of the branch 3300404 to hidden.

jungle changed the visibility of the branch 3300404-deprecated-function-unserialize to hidden.

jungle changed the visibility of the branch 3300404 to active.

jungle changed the visibility of the branch 3300404 to active.

jungle’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record

Thanks for a clear issue summary!

Can we get a change record for the new public function that could be used for others. Sure a contrib module out there maybe could leverage it.

oldspot’s picture

The changes in MR 8092 worked great testing them now on a D10.3.6 install. Thanks.

joseph.olstad’s picture

Patch 63 works well on 10.4.0

spokje’s picture

Status: Needs work » Needs review

Added a first draft for a CR.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: -Needs change record

CR reads well.

Left some small comments on the MR. But super close and will keep an eye out for this one.

spokje’s picture

Status: Needs work » Needs review
gdaw’s picture

Works good on Drupal Version 10.4.1

smustgrave’s picture

Status: Needs review » Needs work

Appears to be 1 open thread, @berdir should this be postponed on #3421234: Json and PHP serializers should throw exception on failure which is also up for review?

dcam’s picture

The Link field also has this problem with its serialized options column that can be NULL. See #2871217: Handle NULL URL options in LinkFormatter::buildUrl().

dcam’s picture

I'm not done working on this, but I need to save my progress because I've been making these changes on my work laptop and I'm about to head home for the weekend.

I agree with the things @berdir said.

this probably shouldn't be public inside the storage, it's not a meant to be a public api?

Yeah, I don't think we should put utility methods in entity storage classes. That's the kind of thing services are for. And we already have a service for serialization. Let's use it.

I'm not sure if we should silently drop invalid values

No, we shouldn't. We should be doing whatever PhpSerialize does. The utility method picked up a few extra things that it did that are outside the scope of this issue. Dropping the invalid values were included. It also included converting empty strings to NULL. That's a behavior change that could impact downstream code and I don't even know what prompted it. I got rid of all of it. Now the safeUnserialize() function only checks the NULL case, then passes the work off to PhpSerialize.

testSafeUnserialize has to be updated because I made that static utility function protected. Also, InitializeSerializedPropTest passes with or without the bug fix. So something about that test is wrong. Edit: I take that back. It does trigger the deprecation warnings when run without the fix. I must have not reset the fix properly the other day.

dcam’s picture

Also, I don't think we need to postpone this on #3421234. We just need to use PhpSerialize. Then it can do whatever it's going to do and the entity storage will benefit from those improvements.

dcam’s picture

Title: Unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage » Handle nullable serialized field columns
Issue summary: View changes
Status: Needs work » Needs review

Implementing PhpSerialize and injecting it into the class resulted in hundreds of deprecation errors. I didn't want to deal with that, so I dropped the idea. So now the only thing this change does is check for the NULL case, which is what it was originally about. If someone wants to pick up possible improvements to unserialization that might happen in PhpSerialize in the future, then they can do that in a separate issue. Let's keep this about fixing the NULL errors, which is a problem specific to how Drupal interacts with the database.

I deleted the tests that were written previously. One was no longer relevant because of the change away from a static function. I felt that the other one wasn't focused enough. It tried to replicate the older steps to reproduce the problem which involved making an entity, then later adding a serialized base field to the entity type. Basically, it was focused on testing the symptom, not the actual problem. I wrote a new test that checks nullable fields in both dedicated and shared tables.

dcam’s picture

I don't know if the CR is necessary anymore. It was written because a new static helper function was being added, but that's no longer true.

smustgrave’s picture

Status: Needs review » Needs work

Left a small comment if it can be expanded. Agree though this may not need a CR.

dcam’s picture

Status: Needs work » Needs review

The feedback was addressed. Thank you to @smustgrave for prioritizing the review of this issue.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Feedback appears to be addressed

Ran the test-only job

1 test triggered 2 PHP deprecations:
1) /builds/issue/drupal-3300404/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:485
unserialize(): Passing null to parameter #1 ($data) of type string is deprecated
Triggered by:
* Drupal\KernelTests\Core\Entity\FieldSqlStorageTest::testNullSerializedFieldLoad
  /builds/issue/drupal-3300404/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php:585
2) /builds/issue/drupal-3300404/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:1264
unserialize(): Passing null to parameter #1 ($data) of type string is deprecated
Triggered by:
* Drupal\KernelTests\Core\Entity\FieldSqlStorageTest::testNullSerializedFieldLoad
  /builds/issue/drupal-3300404/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php:585
OK, but there were issues!
Tests: 9, Assertions: 142, Deprecations: 2.
Exiting with EXIT_CODE=0

Haven't deleted the CR just in case but rest LGTM.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Added an MR comment. Sorry I should have spotted this earlier but the method name is problematic as it does nothing to address security issues with unserialize even though it sounds like it does.

dcam’s picture

Status: Needs work » Needs review

Feedback has been addressed. Setting to Needs Review for a 3rd opinion on the change.

alexpott’s picture

Issue summary: View changes
alexpott’s picture

I've updated the issue summary and CR with the new name.

alexpott’s picture

I've updated the contribution record for this issue.

dcam’s picture

I've updated the issue summary and CR with the new name.

Thank you. Sorry I forgot about doing that.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Feedback for a new name appears to be addressed Thanks!

  • alexpott committed 4a32768c on 11.x
    Issue #3300404 by alexpott, akoe, wranvaud, holo96, quietone, smustgrave...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4a32768 and pushed to 11.x. Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

quietone’s picture

Status: Fixed » Needs work
Issue tags: +Needs change record updates

I think the change record needs to clarify that this change is specific to \Drupal\Core\Entity\Sql\SqlContentEntityStorage. As it reads to me it implies that all instances of unserialize in core are affected.

dcam’s picture

Status: Needs work » Fixed

I updated the CR. I believe that I made it clear that this change only affects SqlContentEntityStorage.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

quietone’s picture

@dcam, thanks for that. I did more work on restructuring the Change Record so that the change is the first thing mentioned and there is a before and after section. None of that should have changed the meaning. If I made a mistake, just edit it as needed.

I published the change record.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.