Subtheme causes error "Undefined constant 'CSS_JS' in constant()" after upgrade to Drupal 9

Created on 1 March 2023, over 1 year ago
Updated 6 December 2023, 7 months ago

Problem/Motivation

I have upgraded a site from Drupal 8 to 9, including an update of the Bootstrap module to version 8.x-3.27. Now I am trying to adapt my subtheme to the new versions. But I can't even get the most simple subtheme config to run without errors. I followed the steps from http://drupal-bootstrap.org/api/bootstrap/docs!Sub-Theming.md/group/sub_..., but everytime I open a page that uses the subtheme, I get a white screen (WSOD) with the error message "The website encountered an unexpected error. Please try again later.". In the error logs, there is this message:

Error: Undefined constant "CSS_JS" in constant() (Zeile 180 in /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php)

#0 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php(180): constant()
#1 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(87): Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension()
#2 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(66): Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions()
#3 /var/www/html/my_site/web/core/lib/Drupal/Core/Cache/CacheCollector.php(149): Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss()
#4 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(149): Drupal\Core\Cache\CacheCollector->get()
#5 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(111): Drupal\Core\Asset\LibraryDiscoveryCollector->applyLibrariesExtend()
#6 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(66): Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions()
#7 /var/www/html/my_site/web/core/lib/Drupal/Core/Cache/CacheCollector.php(149): Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss()
#8 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(149): Drupal\Core\Cache\CacheCollector->get()
#9 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(111): Drupal\Core\Asset\LibraryDiscoveryCollector->applyLibrariesExtend()
#10 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(66): Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions()
#11 /var/www/html/my_site/web/core/lib/Drupal/Core/Cache/CacheCollector.php(149): Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss()
#12 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscovery.php(44): Drupal\Core\Cache\CacheCollector->get()
#13 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDiscovery.php(58): Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension()
#14 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(68): Drupal\Core\Asset\LibraryDiscovery->getLibraryByName()
#15 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(70): Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies()
#16 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(41): Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies()
#17 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/AssetResolver.php(104): Drupal\Core\Asset\LibraryDependencyResolver->getLibrariesWithDependencies()
#18 /var/www/html/my_site/web/core/lib/Drupal/Core/Asset/AssetResolver.php(116): Drupal\Core\Asset\AssetResolver->getLibrariesToLoad()
#19 /var/www/html/my_site/web/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(312): Drupal\Core\Asset\AssetResolver->getCssAssets()
#20 /var/www/html/my_site/web/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(158): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries()
#21 /var/www/html/my_site/web/core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php(45): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments()
#22 [internal function]: Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond()
#23 /var/www/html/my_site/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#24 /var/www/html/my_site/vendor/symfony/http-kernel/HttpKernel.php(202): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#25 /var/www/html/my_site/vendor/symfony/http-kernel/HttpKernel.php(148): Symfony\Component\HttpKernel\HttpKernel->filterResponse()
#26 /var/www/html/my_site/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#27 /var/www/html/my_site/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#28 /var/www/html/my_site/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#29 /var/www/html/my_site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#30 /var/www/html/my_site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#31 /var/www/html/my_site/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#32 /var/www/html/my_site/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#33 /var/www/html/my_site/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#34 /var/www/html/my_site/web/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle()
#35 /var/www/html/my_site/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#36 {main}

I have been trying for hours to find the underlying cause, but without success.

Steps to reproduce

Create a Bootstrap subtheme, install and activate it. Visit a page that uses the subtheme.

Proposed resolution

No idea.

Remaining tasks

Find what causes the error.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.29

Component

Code

Created by

🇩🇪Germany yan

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

Comments & Activities

  • Issue created by @yan
  • 🇮🇳India ravi kant Jaipur

    @yan
    What is version of bootstrap theme. I hope you have updated theme version also according D9.

    Also a long time happen to generate this issue so is it solved for you?

  • 🇩🇪Germany yan

    Sorry, I haven't had time to work on this. But the problem still exists. I have also upgraded to Drupal 10 and the message is the same. Probably I'll have to re-create the theme but I was hoping to avoid that..

    I am using Bootstrap 8.x-3.29 now.

Production build 0.69.0 2024