Problem/Motivation

\Drupal\user\Plugin\migrate\source\d6\User::prepareRow() causes deprecations on PHP 8.1 because it tries to unserialize a NULL.

Steps to reproduce

Run \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\UserTest on PHP 8.1

Proposed resolution

Fix it so that we don't pass NULL to unserialize

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#3 3241275-3.patch677 bytesalexpott
#3 2-3-interdiff.txt618 bytesalexpott
#2 3241275-2.patch755 bytesalexpott

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
StatusFileSize
new755 bytes

Before

PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.0RC3-dev
Configuration: /Users/alex/dev/sites/drupal8alt.dev/phpunit.xml
Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\UserTest
.                                                                   1 / 1 (100%)

Time: 00:01.876, Memory: 10.00 MB

OK (1 test, 72 assertions)

Unsilenced deprecation notices (4)

  4x: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated
    4x in UserTest::testSource from Drupal\Tests\user\Kernel\Plugin\migrate\source\d6

After

PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.0RC3-dev
Configuration: /Users/alex/dev/sites/drupal8alt.dev/phpunit.xml
Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\UserTest
.                                                                   1 / 1 (100%)

Time: 00:01.402, Memory: 10.00 MB

OK (1 test, 72 assertions)
alexpott’s picture

StatusFileSize
new618 bytes
new677 bytes

Looking at core/modules/user/migrations/d6_user_contact_settings.yml which is the only migration I can find that uses this I don't think the difference between NULL and FALSE matters at all as we're doing skip_row_if_not_set which is looking for a contact key in data - which when it's FALSE or NULL can't be.

alexpott’s picture

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Thank you, straightforward

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed 84862ba and pushed to 9.3.x. Thanks!

  • larowlan committed 84862ba on 9.3.x
    Issue #3241275 by alexpott: \Drupal\user\Plugin\migrate\source\d6\User::...

Status: Fixed » Closed (fixed)

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