Step 30/41 : RUN /etc/init.d/mysql start && vendor/bin/drupal moi -y basic_auth jsonapi restui
---> Running in 736b975091cf
Starting MySQL database server: mysqld ..
Checking for tables which need an upgrade, are corrupt or were
not closed cleanly..
Installing module(s) "basic_auth, jsonapi, restui, rest"
PHP Fatal error: Access level to Drupal\serialization\Normalizer\NormalizerBase::addCacheableDependency() must be public (as in class Drupal\Core\Cache\RefinableCacheableDependencyInterface) in /var/www/html/modules/jsonapi/src/Normalizer/RelationshipItemNormalizer.php on line 18
PHP Stack trace:
PHP 1. {main}() /var/www/html/vendor/drupal/console/bin/drupal:0
PHP 2. require() /var/www/html/vendor/drupal/console/bin/drupal:4
PHP 3. Symfony\Component\Console\Application->run() /var/www/html/vendor/drupal/console/bin/drupal.php:88
PHP 4. Drupal\Console\Application->doRun() /var/www/html/vendor/symfony/console/Application.php:124
PHP 5. Drupal\Console\Core\Application->doRun() /var/www/html/vendor/drupal/console/src/Application.php:64
PHP 6. Symfony\Component\Console\Application->doRun() /var/www/html/vendor/drupal/console-core/src/Application.php:192
PHP 7. Symfony\Component\Console\Application->doRunCommand() /var/www/html/vendor/symfony/console/Application.php:200
PHP 8. Symfony\Component\Console\Command\Command->run() /var/www/html/vendor/symfony/console/Application.php:853
PHP 9. Drupal\Console\Command\Module\InstallCommand->execute() /var/www/html/vendor/symfony/console/Command/Command.php:264
PHP 10. Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() /var/www/html/vendor/drupal/console/src/Command/Module/InstallCommand.php:227
PHP 11. Drupal\Core\Extension\ModuleInstaller->install() /var/www/html/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83
PHP 12. Drupal\Core\Extension\ModuleHandler->invokeAll() /var/www/html/core/lib/Drupal/Core/Extension/ModuleInstaller.php:316
PHP 13. call_user_func_array:{/var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php:402}() /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php:402
PHP 14. default_content_modules_installed() /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php:402
PHP 15. Drupal::service() /var/www/html/modules/contrib/default_content/default_content.module:15
PHP 16. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/html/core/lib/Drupal.php:158
PHP 17. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:451
PHP 18. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:879
PHP 19. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:954
PHP 20. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:957
PHP 21. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:451
PHP 22. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:879
PHP 23. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:954
PHP 24. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:954
PHP 25. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:957
PHP 26. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:451
PHP 27. ReflectionClass->__construct() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:898
PHP 28. spl_autoload_call() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:898
PHP 29. Symfony\Component\ClassLoader\ApcClassLoader->loadClass() /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:0
PHP 30. require() /var/www/html/vendor/symfony/class-loader/ApcClassLoader.php:110

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jian he created an issue. See original summary.

Wim Leers’s picture

Confirmed. Although I get a different error (I'm running PHP 7):

Warning: Declaration of Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheableDependency($other_object) should be compatible with Drupal\serialization\Normalizer\NormalizerBase::addCacheableDependency(array $context, $data) in include() (line 18 of modules/jsonapi/src/Normalizer/RelationshipItemNormalizer.php).
include('/Users/wim.leers/Work/d8/modules/jsonapi/src/Normalizer/RelationshipItemNormalizer.php') (Line: 444)
Wim Leers’s picture

Darn, this is happening because \Drupal\serialization\Normalizer\NormalizerBase::addCacheableDependency() was added in #2910211: Allow computed exposed properties in ComplexData to support cacheability.. Which means that \Drupal\jsonapi\Normalizer\RelationshipItemNormalizer of course cannot use RefinableCacheableDependencyTrait;, because that results in that method being defined twice.

If JSON API were doing automated daily testing against the dev branch of D8, it'd have detected this failure the day when it was committed. (But the day of the last commit, the test did fail, so we do know that test coverage is adequate for detecting this: https://www.drupal.org/pift-ci-job/807271).

However … the fix is easy: it simply does not make sense for a normalizer to use RefinableCacheableDependencyTrait, that trait only makes sense for value objects carrying cacheability! #2759951: [FEATURE] Make sure all cacheability metadata is added introduced that.

Wim Leers’s picture

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +API-First Initiative

The failures in #3 are all due to #2870194: Ensure that process-isolated tests can use Symfony's PHPunit bridge to catch usages of deprecated code causing uses of deprecated APIs to show test failures. The actual problem is solved: the failure present in https://www.drupal.org/pift-ci-job/807271 is now absent.

HEAD
Testing Drupal\Tests\jsonapi\Functional\RestJsonApiUnsupported
E

Time: 4.57 seconds, Memory: 4.00MB

There was 1 error:

1) Drupal\Tests\jsonapi\Functional\RestJsonApiUnsupported::testApiJsonNotSupportedInRest
Exception: Warning: Declaration of Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheableDependency($other_object) should be compatible with Drupal\serialization\Normalizer\NormalizerBase::addCacheableDependency(array $context, $data)
require()() (Line: 18)
Patch

Testing Drupal\Tests\jsonapi\Functional\RestJsonApiUnsupported
.

Time: 4.98 seconds, Memory: 4.00MB

OK (1 test, 5 assertions)
Wim Leers’s picture

Title: Fatal error on D8.5.x: Access level to NormalizerBase::addCacheableDependency() must be public » Fatal error on 8.5.x: RelationshipItemNormalizer implements RefinableCacheableDependencyInterface, but should not

Improving title, crediting @jian he.

  • Wim Leers committed 45ef110 on 8.x-1.x
    Issue #2926291 by Wim Leers, jian he: Fatal error on 8.5.x:...
Wim Leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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