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
•
04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher
•
26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...
Andrew Fletcher
•
17 Mar 2025
Upgrading to PHP 8.4 challenges with Drupal contrib modules
The upgrade from PHP 8.3.14 to PHP 8.4.4 presents challenges for Drupal 10.4 websites, particularly when dealing with contributed modules. While Drupal core operates seamlessly, various contrib modules have not yet been updated to accommodate changes introduced in PHP 8.4.x. This has resulted in...