Islandora / islandora

Drupal modules for browsing and managing digital repositories.
http://islandora.ca/
GNU General Public License v2.0
153 stars 119 forks source link

[BUG] PHP 8.1 compatibility #887

Closed rosiel closed 1 year ago

rosiel commented 2 years ago

Automated tests fail on PHP 8.1. Example.

1 - Stomp is not 8.1 compatible. This is a known issue. 2 - During our JsonldTypeAlterReactionTest, NULL gets sent to mb_strtolower() and that's deprecated in 8.1. My attempt to parse the error is that we try to compile() a Drupal\Core\Config\Entity\Query\Condition with $condition['value'] of NULL?

PHPUnit 9.5.21 #StandWithUkraine
Runtime:       PHP 8.1.8
Configuration: /opt/drupal/web/core/phpunit.xml
Testing 
......E....E..E......                                             21 / 21 (100%)
Time: 17:28.178, Memory: 16.00 MB
There were 3 errors:

1) Drupal\Tests\islandora\Functional\EmitNodeEventTest::testEmitEvent
Exception: Deprecated function: Return type of Stomp\Transport\Frame::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
include()() (Line: 19)

/opt/drupal/web/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:49
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:204
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:153
/opt/drupal/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:248
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:224
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:269
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:226
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:62
/opt/drupal/vendor/guzzlehttp/guzzle/src/Client.php:182
/opt/drupal/web/core/tests/Drupal/Tests/DrupalTestBrowser.php:137
/opt/drupal/vendor/symfony/browser-kit/Client.php:404
/opt/drupal/vendor/symfony/browser-kit/Client.php:324
/opt/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:719
/opt/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:494
/opt/drupal/vendor/behat/mink/src/Element/NodeElement.php:153
/opt/drupal/vendor/behat/mink/src/Element/NodeElement.php:161
/opt/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:100
/opt/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:216
/home/runner/work/islandora/islandora/build_dir/tests/src/Functional/IslandoraFunctionalTestBase.php:315
/home/runner/work/islandora/islandora/build_dir/tests/src/Functional/EmitNodeEventTest.php:53
/opt/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:726

2) Drupal\Tests\islandora\Functional\IslandoraSettingsFormTest::testJwtExpiry
Exception: Deprecated function: Return type of Stomp\States\Meta\SubscriptionList::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
include()() (Line: 23)

/opt/drupal/web/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:49
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:204
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:153
/opt/drupal/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:248
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:224
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:269
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:226
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:62
/opt/drupal/vendor/guzzlehttp/guzzle/src/Client.php:182
/opt/drupal/web/core/tests/Drupal/Tests/DrupalTestBrowser.php:137
/opt/drupal/vendor/symfony/browser-kit/Client.php:404
/opt/drupal/vendor/symfony/browser-kit/Client.php:324
/opt/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:719
/opt/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:494
/opt/drupal/vendor/behat/mink/src/Element/NodeElement.php:153
/opt/drupal/vendor/behat/mink/src/Element/NodeElement.php:161
/opt/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:100
/opt/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:216
/home/runner/work/islandora/islandora/build_dir/tests/src/Functional/IslandoraSettingsFormTest.php:40
/opt/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:726

3) Drupal\Tests\islandora\Functional\JsonldTypeAlterReactionTest::testMappingReaction
Exception: Deprecated function: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
Drupal\Core\Config\Entity\Query\Condition->compile()() (Line: 39)

/opt/drupal/web/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:49
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:204
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:153
/opt/drupal/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:248
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:224
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:269
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:226
/opt/drupal/vendor/guzzlehttp/promises/src/Promise.php:62
/opt/drupal/vendor/guzzlehttp/guzzle/src/Client.php:182
/opt/drupal/web/core/tests/Drupal/Tests/DrupalTestBrowser.php:137
/opt/drupal/vendor/symfony/browser-kit/Client.php:404
/opt/drupal/vendor/symfony/browser-kit/Client.php:324
/opt/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:719
/opt/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:494
/opt/drupal/vendor/behat/mink/src/Element/NodeElement.php:153
/opt/drupal/vendor/behat/mink/src/Element/NodeElement.php:161
/opt/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:100
/opt/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:216
/home/runner/work/islandora/islandora/build_dir/tests/src/Functional/JsonldTypeAlterReactionTest.php:30
/opt/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
ERRORS!
Tests: 21, Assertions: 340, Errors: 3.

What steps does it take to reproduce the issue?

Which version of Islandora are you using?

Any related open or closed issues to this bug report?

Screenshots:

whikloj commented 1 year ago

It seems like stomp-php/stomp-php may have been abandoned. There seem to be a tonne of forks out there now. We could switch to one of them like https://packagist.org/packages/invia-de/stomp-php which supports PHP 8.

Alternatively, we could rethink the entire Alpaca routing layer.

adam-vessey commented 1 year ago

Looks like https://github.com/stomp-php/stomp-php/pull/174 was merged; however, doesn't appear to be a release minted with it yet. PHP 8.1-supporting release forthcoming?

whikloj commented 1 year ago

Yeah somehow I ended up as a maintainer. I don't have a clear understanding of what their process is, but I'm going to try and push a 5.1.0 tag out shortly.

rosiel commented 1 year ago

Thank you @whikloj!

rosiel commented 1 year ago

Running on PHP 8.1 with stomp-php/stomp-php 5.1.0, I'm still getting the following errors, which are the same as the ones in this original ticket:

5) Drupal\Tests\islandora\Functional\EmitNodeEventTest::testEmitEvent
Exception: Deprecated function: Return type of Stomp\Transport\Frame::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
include()() (Line: 19)

/var/www/html/drupal/web/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:49
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:204
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:153
/var/www/html/drupal/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:248
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:224
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:269
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:226
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:62
/var/www/html/drupal/vendor/guzzlehttp/guzzle/src/Client.php:182
/var/www/html/drupal/web/core/tests/Drupal/Tests/DrupalTestBrowser.php:137
/var/www/html/drupal/vendor/symfony/browser-kit/Client.php:404
/var/www/html/drupal/vendor/symfony/browser-kit/Client.php:324
/var/www/html/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:719
/var/www/html/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:494
/var/www/html/drupal/vendor/behat/mink/src/Element/NodeElement.php:153
/var/www/html/drupal/vendor/behat/mink/src/Element/NodeElement.php:161
/var/www/html/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:100
/var/www/html/drupal/web/modules/contrib/islandora/tests/src/Functional/IslandoraFunctionalTestBase.php:318
/var/www/html/drupal/web/modules/contrib/islandora/tests/src/Functional/EmitNodeEventTest.php:53
/var/www/html/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

6) Drupal\Tests\islandora\Functional\IslandoraSettingsFormTest::testJwtExpiry
Exception: Deprecated function: Return type of Stomp\States\Meta\SubscriptionList::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
include()() (Line: 23)

/var/www/html/drupal/web/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:49
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:204
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:153
/var/www/html/drupal/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:248
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:224
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:269
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:226
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:62
/var/www/html/drupal/vendor/guzzlehttp/guzzle/src/Client.php:182
/var/www/html/drupal/web/core/tests/Drupal/Tests/DrupalTestBrowser.php:137
/var/www/html/drupal/vendor/symfony/browser-kit/Client.php:404
/var/www/html/drupal/vendor/symfony/browser-kit/Client.php:324
/var/www/html/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:719
/var/www/html/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:494
/var/www/html/drupal/vendor/behat/mink/src/Element/NodeElement.php:153
/var/www/html/drupal/vendor/behat/mink/src/Element/NodeElement.php:161
/var/www/html/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:100
/var/www/html/drupal/web/modules/contrib/islandora/tests/src/Functional/IslandoraSettingsFormTest.php:41
/var/www/html/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

7) Drupal\Tests\islandora\Functional\JsonldTypeAlterReactionTest::testMappingReaction
Exception: Deprecated function: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
Drupal\Core\Config\Entity\Query\Condition->compile()() (Line: 39)

/var/www/html/drupal/web/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:49
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:204
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:153
/var/www/html/drupal/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:248
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:224
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:269
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:226
/var/www/html/drupal/vendor/guzzlehttp/promises/src/Promise.php:62
/var/www/html/drupal/vendor/guzzlehttp/guzzle/src/Client.php:182
/var/www/html/drupal/web/core/tests/Drupal/Tests/DrupalTestBrowser.php:137
/var/www/html/drupal/vendor/symfony/browser-kit/Client.php:404
/var/www/html/drupal/vendor/symfony/browser-kit/Client.php:324
/var/www/html/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:719
/var/www/html/drupal/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:494
/var/www/html/drupal/vendor/behat/mink/src/Element/NodeElement.php:153
/var/www/html/drupal/vendor/behat/mink/src/Element/NodeElement.php:161
/var/www/html/drupal/web/core/tests/Drupal/Tests/UiHelperTrait.php:100
/var/www/html/drupal/web/modules/contrib/islandora/tests/src/Functional/JsonldTypeAlterReactionTest.php:33
/var/www/html/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

ERRORS!
Tests: 70, Assertions: 898, Errors: 7, Skipped: 1.
whikloj commented 1 year ago

Is this running somewhere I might be able to view the logs?

rosiel commented 1 year ago

must have been a caching issue, it seems to be working now.