Problem/Motivation

\Drupal\Tests\Component\Gettext\PoStreamWriterTest::setUp () causes deprecations on PHP 8.1 because of vfs issues
See #3220021-34: [meta] Ensure compatibility of Drupal 9 with PHP 8.1 (as it evolves) and commit https://git.drupalcode.org/project/drupal/-/merge_requests/937/diffs?com... for credits

Steps to reproduce

Run core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php on PHP 8.1

Proposed resolution

Fix the test and wait upstream release as PHP 8.1 released https://github.com/bovigo/vfsStream/issues/252#issuecomment-836191861

Remaining tasks

review/commit

User interface changes

no

API changes

no

Data model changes

no

Release notes snippet

no

CommentFileSizeAuthor
#2 3240201-2.patch968 bytesandypost
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
FileSize
968 bytes

patch from commit

andypost’s picture

andypost’s picture

But without patch still getting

Remaining self deprecation notices (14)

  7x: fwrite(): Passing null to parameter #2 ($data) of type string is deprecated
    7x in PoStreamWriterTest::testWriteItem from Drupal\Tests\Component\Gettext

  7x: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
    7x in PoStreamWriterTest::testWriteItem from Drupal\Tests\Component\Gettext

I bet the fix is required because mikey179/vfsstream 1.6.9 already contains fix https://github.com/bovigo/vfsStream/issues/252#issuecomment-881271842

daffie’s picture

Status: Needs review » Reviewed & tested by the community

The $this->poWriter->header must be set, because calling $this->poWriter->open() uses the value as the second parameter in the function call to fwrite() and that must be a string value.
Looks good to me.

  • catch committed 91f5fa9 on 9.3.x
    Issue #3240201 by andypost, daffie: \Drupal\Tests\Component\Gettext\...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 91f5fa9 and pushed to 9.3.x. Thanks!

Status: Fixed » Closed (fixed)

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