Andrew Fletcher published: 20 June 2023 1 minute read
Whilst attempting to download the latest config.zip file for Solr, I was greeted by the following error:
Error: Class "MyCLabs\Enum\Enum" not found in include() (line 18 of /var/www/vhosts/{domain.com}/vendor/maennchen/zipstream-php/src/Option/Method.php)
#0 /var/www/vhosts/{domain.com}/vendor/composer/ClassLoader.php(582): include()
#1 /var/www/vhosts/{domain.com}/vendor/composer/ClassLoader.php(433): Composer\Autoload\{closure}()
#2 /var/www/vhosts/{domain.com}/vendor/maennchen/zipstream-php/src/Option/Archive.php(131): Composer\Autoload\ClassLoader->loadClass()
#3 /var/www/vhosts/{domain.com}/modules/contrib/search_api_solr/src/Controller/SolrConfigSetController.php(462): ZipStream\Option\Archive->__construct()
#4 [internal function]: Drupal\search_api_solr\Controller\SolrConfigSetController->streamConfigZip()
#5 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#6 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#7 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#8 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#9 /var/www/vhosts/{domain.com}/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /var/www/vhosts/{domain.com}/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#11 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#12 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#13 /var/www/vhosts/{domain.com}/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#14 /var/www/vhosts/{domain.com}/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#15 /var/www/vhosts/{domain.com}/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#16 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#17 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#18 /var/www/vhosts/{domain.com}/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#19 /var/www/vhosts/{domain.com}/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#20 /var/www/vhosts/{domain.com}/index.php(19): Drupal\Core\DrupalKernel->handle()
#21 {main}
Reading through the notes on the Enum Github page and I read the following key line
"First, and mainly, SplEnum is not integrated to PHP, you have to install the extension separately."
Installation is to run the following composer command:
composer require myclabs/php-enum
But first I want to validate if Enum exists on the environment. A quick read of enum_exists and testing is via adding code.
Related articles
Andrew Fletcher
•
09 May 2024
Accessing nested paragraph fields in Drupal: a step-by-step reference
The issue – I have a content type that includes an entity reference revisions field named field_introduction. This field points to a paragraph, which itself contains a text field also named field_introduction, of the type Text (formatted, long). How can I access the content stored in this...
Andrew Fletcher
•
09 May 2024
How to retrieve the current menu title in Drupal – a developer’s reference
When building a theme in Drupal, it's often necessary to adapt your site’s UI dynamically based on the context in which a user is navigating. One such piece of dynamic content is the menu title. Achieving this can be a bit tricky due to the layered nature of its routing and menu systems. This...
Andrew Fletcher
•
07 May 2024
Understanding and resolving a Drupal render array error
Dealing with errors in Drupal development is a common occurrence, and understanding how to interpret and resolve them is essential for smooth development workflows. In this article, we'll delve into a specific error message related to render arrays in Drupal and discuss steps to diagnose and fix the...