Closed (fixed)
Project:
Simplenews
Version:
4.1.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Jan 2025 at 10:07 UTC
Updated:
8 Aug 2026 at 12:45 UTC
Jump to comment: Most recent
There seems to be a bug in the code which generates the form to request a new confirmation mail. When the button is clicked, an error message occurs and no mail is generated.
#0 [internal function]: simplenews_mail('confirm', Array, Array)
#1 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(400): call_user_func_array(Object(Closure), Array)
#2 /var/www/html/web/modules/contrib/symfony_mailer/src/Plugin/EmailBuilder/LegacyEmailBuilder.php(124): Drupal\Core\Extension\ModuleHandler->invoke('simplenews', 'mail', Array)
#3 [internal function]: Drupal\symfony_mailer\Plugin\EmailBuilder\LegacyEmailBuilder->build(Object(Drupal\symfony_mailer\Email))
#4 /var/www/html/web/modules/contrib/symfony_mailer/src/Email.php(490): call_user_func(Array, Object(Drupal\symfony_mailer\Email))
#5 /var/www/html/web/modules/contrib/symfony_mailer/src/Mailer.php(179): Drupal\symfony_mailer\Email->process()
#6 /var/www/html/web/modules/contrib/symfony_mailer/src/Mailer.php(149): Drupal\symfony_mailer\Mailer->doSend(Object(Drupal\symfony_mailer\Email))
#7 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\symfony_mailer\Mailer->Drupal\symfony_mailer\{closure}()
#8 /var/www/html/web/modules/contrib/symfony_mailer/src/Mailer.php(158): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#9 /var/www/html/web/modules/contrib/symfony_mailer/src/Email.php(292): Drupal\symfony_mailer\Mailer->send(Object(Drupal\symfony_mailer\Email))
#10 /var/www/html/web/modules/contrib/symfony_mailer/src/MailManagerReplacement.php(92): Drupal\symfony_mailer\Email->send()
#11 /var/www/html/web/modules/contrib/simplenews/src/Form/RequestHashForm.php(79): Drupal\symfony_mailer\MailManagerReplacement->mail('simplenews', 'confirm', 'jane.doe@zebral...', 'de', Array, 'drupal@zebralog...')
#12 [internal function]: Drupal\simplenews\Form\RequestHashForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
#13 /var/www/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array(Array, Array)
#14 /var/www/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#15 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(606): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#16 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('simplenews_requ...', Array, Object(Drupal\Core\Form\FormState))
#17 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(224): Drupal\Core\Form\FormBuilder->buildForm('\\Drupal\\simplen...', Object(Drupal\Core\Form\FormState))
#18 /var/www/html/web/modules/contrib/simplenews/src/Controller/ConfirmationController.php(87): Drupal\Core\Form\FormBuilder->getForm('\\Drupal\\simplen...', 'confirm', Array)
#19 [internal function]: Drupal\simplenews\Controller\ConfirmationController->confirmSubscribe('6', '1736532312', 'hVxZMHQiWznbKdH...', false)
#20 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#21 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#23 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#24 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#25 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#26 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#38 {main}
This happens in "RequestHashForm". Line 79 apparently uses the key "confirm", which isn't expected anymore in "simplenews_mail". I think this is built in "ConfirmationController" in line 87:
$build = $this->formBuilder()->getForm('\Drupal\simplenews\Form\RequestHashForm', 'confirm', $context);
This should use "subscribe_combined" instead of "confirm".
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
deepali sardana commentedComment #4
deepali sardana commentedComment #6
ammaletu commentedI created a merge request with the proposed fix. I'm not a 100% sure that this is indeed the best solution. There are still three or four places which use 'confirm' in the module. Changing the key here to 'subscribe_combined' works, I just tested it in the 4.1.0 version. So somebody with a better understanding of how the module works shoudl have a look.
Also, this might need a test if it could break without anybody noticing. :-) Looking at the existing tests, it seems this would belong into "SimplenewsSubscribeTest". Maybe as a variant of "testSubscribeAnonymous"?!
Ok, wow, I did not expect someone to work on this within minutes. :-) Should I simple close my MR again?!
Comment #8
adamps commentedThanks for the report. The patch looks good. Both MR are the same so I hid the later one (yes please close it). I believe the other uses of 'confirm' are correct (but it's a bit mind-boggling trying to work it all out😃).
The failing test is unrelated to this issue - it fails anyway due to a change in Core and needs a simple fix.
Yes it would be great to have a test. If you search the code for
'This link has expired.'you can see 2 places that test expired links. I cannot understand why these tests don't currently fail.Comment #9
adamps commentedI have now fixed the tests on 4.x and merged here so tests are passing.
Remaining work is for the tests, we need a test that covers this case. Starting point: how come they weren't already failing?
Comment #11
andre.bononThe patch from #77 diff works for me.
Comment #12
andre.bononRe-rolled the patch against the latest dev 4.x
Comment #13
adamps commentedI fixed the tests - I added some asserts that fail before the fix is applied. The fix is now ready for commit.
Unfortunately the tests are failing on the 4.x branch, see #3542503: Fix tests, so we need to wait for that to be fixed.
Comment #14
adamps commentedTests are now fixed needs reroll
Comment #15
adamps commentedComment #17
adamps commentedThanks everyone