Drupal 8.8 Error creating service

Created on 16 December 2019, almost 5 years ago
Updated 18 October 2023, about 1 year ago

On the latest dev branch + Drupal 8.8 core the following error is generated when trying to create a service definition:

Error: Call to a member function get() on null in Drupal\cas_server\Form\ServicesForm->exist() (line 124 of /Users/marcbrooks/work/obauth/web/modules/contrib/cas_server/src/Form/ServicesForm.php) #0 [internal function]: Drupal\cas_server\Form\ServicesForm->exist('test', Array, Object(Drupal\Core\Form\FormState)) #1 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/Render/Element/MachineName.php(267): call_user_func(Array, 'test', Array, Object(Drupal\Core\Form\FormState)) #2 [internal function]: Drupal\Core\Render\Element\MachineName::validateMachineName(Array, Object(Drupal\Core\Form\FormState), Array) #3 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/Form/FormValidator.php(282): call_user_func_array(Array, Array) #4 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/Form/FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #5 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'cas_server_serv...') #6 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/Form/FormBuilder.php(577): Drupal\Core\Form\FormValidator->validateForm('cas_server_serv...', Array, Object(Drupal\Core\Form\FormState)) #7 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm('cas_server_serv...', Array, Object(Drupal\Core\Form\FormState)) #8 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/Controller/FormController.php(91): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\cas_server\Form\ServicesForm), Object(Drupal\Core\Form\FormState)) #9 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #10 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #11 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #12 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #13 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #14 /Users/marcbrooks/work/obauth/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #15 /Users/marcbrooks/work/obauth/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #16 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /Users/marcbrooks/work/obauth/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /Users/marcbrooks/work/obauth/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /Users/marcbrooks/work/obauth/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /Users/marcbrooks/work/obauth/web/core/lib/Drupal/Core/DrupalKernel.php(694): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /Users/marcbrooks/work/obauth/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #25 {main}.

This is seemingly caused by the deprecated use of $this->entityQuery->get('cas_server_service') as per the following article ( https://www.drupal.org/node/2849874 ) please find attached a patch to rectify this issue. Tested and working on latest dev for me.

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

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