Problem/Motivation
In order to be able to use Guzzle 6 on PHP 8.1 we need the ability to skip E_DEPRECATED deprecations so we can skip:
Return type of GuzzleHttp\Cookie\CookieJar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Return type of GuzzleHttp\Cookie\CookieJar::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Unfortunately it doesn't seem that the Guzzle team want to release a new version of Guzzle 6. We will upgrade to Guzzle 7 in Drupal 10 and might change our dependencies to allow Guzzle 7 with Drupal 9 but this is the easiest fix to do for PHP 8.1 compatibility in Drupal 9.3.
Steps to reproduce
Run (for example) Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#11 | 3240456-11.patch | 4.01 KB | alexpott |
#11 | 3-11-interdiff.txt | 1.26 KB | alexpott |
Comments
Comment #2
alexpottPatch attached is from the meta. It allows us to skip deprecations caused by Guzzle and EasyRDF. EasyEDF has a PR to fix PHP 8.1 deprecations but that's not landed yet. If it does we can remove the skip.
I'm thinking about the best way to add a test for this. The fact that tests fail on PHP 8.1 is a kind of test but it might be good to have something explicit. User-land code is not allowed to do
trigger_error('some text', E_DEPRECATED)
- you get a warning...Warning: Uncaught ValueError: trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
Comment #3
alexpottHere's a test. Seems okay to add this note it will only trigger the deprecation on PHP 8.1 so to prove it fails there you need to run the test manually at this point we still are triggering too many deprecation on PHP 8.1.
Here's the output of running the test without the changes to \Drupal\Tests\Listeners\DeprecationListenerTrait...
Comment #4
alexpottArggh the mink deprecations get in the way...
Comment #5
andypostThank you, this patch makes it easy to run all other tests
Running test with test-only patch
using patch it pass
Comment #6
andypostignore this comment
Comment #7
andypostRunning
core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
Comment #8
daffie CreditAttribution: daffie commentedThe testbot is failing for PHP 8.1 rc2 and it should be failing for the test only patch.
Comment #9
alexpott@daffie this is just part of the fixes. The test only patch is to help people run it locally without the fix.
This patch is ready and will help us have green functional tests once we've sorted out behat/mink.
Comment #10
daffie CreditAttribution: daffie commentedThe patch looks good to me, just one remark for me:
This change should already be fixed in version v4.4.30 which is used in core now. See: https://github.com/symfony/symfony/pull/42260.
Comment #11
alexpott@daffie great catch... nice one.
Comment #12
daffie CreditAttribution: daffie commentedAdds the suppressions of 2 from dependency packages coming deprecation warnings and a test suppressing deprecation warning from PHP itself.
Looks good to me.
Comment #14
catchLooks good.
Committed f56323a and pushed to 9.3.x. Thanks!