Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When creating new Pantheon account (drd/settings/pantheon/accounts/add) there is an error
Error: Call to a member function getMachineToken() on null in Drupal\drd_pi_pantheon\Entity\AccountForm->form() (line 19 of /srv/bindings/bec3566911844e4eb34a1495467114c1/code/modules/contrib/drd/modules/drd_pi_pantheon/src/Entity/AccountForm.php)
#0 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/Entity/EntityForm.php(149): Drupal\drd_pi_pantheon\Entity\AccountForm->form(Array, Object(Drupal\Core\Form\FormState))
#1 [internal function]: Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#2 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/Form/FormBuilder.php(520): call_user_func_array(Array, Array)
#3 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/Form/FormBuilder.php(277): Drupal\Core\Form\FormBuilder->retrieveForm('pantheon_accoun...', Object(Drupal\Core\Form\FormState))
#4 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/Controller/FormController.php(91): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\drd_pi_pantheon\Entity\AccountForm), Object(Drupal\Core\Form\FormState))
#5 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#6 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#7 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#8 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#9 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#10 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#11 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#12 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /srv/bindings/bec3566911844e4eb34a1495467114c1/code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#21 {main}
It's related to the fact that machine token is used as default value on the entity form for the Pantheon account but when it's new account then the value returned by the decoding function is NULL. It then violates interface and class requirement and the site crashes.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3143060_drd_fatal_error_when_creating_pantheon_account_2.patch | 516 bytes | amykhailova |
Comments
Comment #2
amykhailova CreditAttribution: amykhailova commentedHere is the patch.
Comment #3
jurgenhaasThat's interesting. It should already be fixed by the function declaration
where the return type string is preceded by the question mark which allows PHP to return either a string or NULL. I'm confused, are you sure the reason is the wrong return type?
Comment #4
amykhailova CreditAttribution: amykhailova commentedThis is what the logs show and with my changes in the patch - the error is fixed. I was playing with the module on the fresh latest D8 and nothing else is installed or customized - only remote dashboard modules.
Comment #5
jurgenhaas@amykhailova what's your PHP version?
Comment #6
amykhailova CreditAttribution: amykhailova commentedPHP v7.3
Comment #7
jurgenhaashttps://gitlab.com/drupalspoons/drd/-/issues/36