Composer autoload issue finding RfcLogLevel class on PHP 8.1.3

Created on 18 February 2022, about 3 years ago
Updated 18 August 2023, over 1 year ago

Problem/Motivation

Hello. I've upgraded my site to Drupal 9.3.6. It works fine on PHP 7.3.

But then I tested it with PHP 8.1.3. This error occurred and stop the site from render:

Error: Class "Drupal\Core\Logger\RfcLogLevel" not found in /var/www/web/core/includes/errors.inc on line 26 #0 /var/www/web/core/includes/errors.inc(60)
#1 /var/www/web/core/includes/bootstrap.inc(346): _drupal_error_handler_real()
#2 /var/www/vendor/composer/ClassLoader.php(571): _drupal_error_handler()
#3 /var/www/vendor/composer/ClassLoader.php(571): include('...')
#4 /var/www/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#5 /var/www/web/core/lib/Drupal/Core/Logger/LoggerChannelFactory.php(34): Composer\Autoload\ClassLoader->loadClass()
#6 [internal function]: Drupal\Core\Logger\LoggerChannelFactory->get()
#7 /var/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php(258): call_user_func_array()
#8 /var/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php(176): Drupal\Component\DependencyInjection\Container->createService()
#9 /var/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php(437): Drupal\Component\DependencyInjection\Container->get()
#10 /var/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php(240): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#11 /var/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php(176): Drupal\Component\DependencyInjection\Container->createService()
#12 /var/www/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(136): Drupal\Component\DependencyInjection\Container->get()
#13 /var/www/vendor/symfony/http-kernel/HttpKernel.php(191): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#14 /var/www/vendor/symfony/http-kernel/HttpKernel.php(179): Symfony\Component\HttpKernel\HttpKernel->filterResponse()
#15 /var/www/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#16 /var/www/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#17 /var/www/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#18 /var/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#19 /var/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch()
#20 /var/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup()
#21 /var/www/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\page_cache\StackMiddleware\PageCache->handle()
#22 /var/www/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle()
#23 /var/www/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#24 /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#25 /var/www/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#26 /var/www/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#27 {main}

If I switch it back to PHP 7.3, everything works fine.

Since it seem to be an autoloader issue, I tried "composer dump-autoload" and "drush cr" a few times. I've also tried to upgrade everything with "composer update". They didn't work.

The software versions:

  • Drupal 9.3.6 (Composer installation)
  • PHP 8.1.3
  • Composer 2.2.6

Steps to reproduce

I'm not sure how to reproduce it.

πŸ’¬ Support request
Status

Closed: duplicate

Version

9.3

Component
BaseΒ  β†’

Last updated about 10 hours ago

Created by

πŸ‡­πŸ‡°Hong Kong yookoala

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024